• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on:
4  push:
5  pull_request:
6  schedule: [cron: "40 1 * * *"]
7
8permissions:
9  contents: read
10
11jobs:
12  pre_ci:
13    uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
14
15  test:
16    name: ${{matrix.name || format('Rust {0}', matrix.rust)}}
17    needs: pre_ci
18    if: needs.pre_ci.outputs.continue
19    runs-on: ${{matrix.os || 'ubuntu'}}-latest
20    strategy:
21      fail-fast: false
22      matrix:
23        include:
24          - rust: nightly
25          - rust: beta
26          - rust: stable
27          - rust: 1.60.0
28          - rust: 1.64.0
29          - name: macOS
30            rust: nightly
31            os: macos
32          - name: Windows (msvc)
33            rust: nightly-x86_64-pc-windows-msvc
34            os: windows
35            flags: /EHsc
36    env:
37      CXXFLAGS: ${{matrix.flags}}
38      RUSTFLAGS: --cfg deny_warnings -Dwarnings
39    timeout-minutes: 45
40    steps:
41      - name: Enable symlinks (windows)
42        if: matrix.os == 'windows'
43        run: git config --global core.symlinks true
44      - uses: actions/checkout@v3
45      - uses: dtolnay/rust-toolchain@master
46        with:
47          toolchain: ${{matrix.rust}}
48      - name: Determine test suite subset
49        # Our Windows and macOS jobs are the longest running, so exclude the
50        # relatively slow compiletest from them to speed up end-to-end CI time,
51        # except during cron builds when no human is presumably waiting on the
52        # build. The extra coverage is not particularly valuable and we can
53        # still ensure the test is kept passing on the basis of the scheduled
54        # builds.
55        run: |
56          echo RUSTFLAGS=$RUSTFLAGS >> $GITHUB_ENV
57          echo exclude=--exclude cxx-test-suite ${{matrix.rust == '1.60.0' && '--exclude cxxbridge-cmd' || ''}} >> $GITHUB_OUTPUT
58        env:
59          RUSTFLAGS: ${{env.RUSTFLAGS}} ${{matrix.os && github.event_name != 'schedule' && '--cfg skip_ui_tests' || ''}}
60        id: testsuite
61        shell: bash
62      - run: cargo run --manifest-path demo/Cargo.toml
63      - run: cargo test --workspace ${{steps.testsuite.outputs.exclude}}
64      - run: cargo check --no-default-features --features alloc
65        env:
66          RUSTFLAGS: --cfg compile_error_if_std ${{env.RUSTFLAGS}}
67      - run: cargo check --no-default-features
68        env:
69          RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}}
70
71  buck:
72    name: Buck
73    runs-on: ubuntu-latest
74    if: github.event_name != 'pull_request'
75    timeout-minutes: 45
76    steps:
77      - uses: actions/checkout@v3
78        with:
79          submodules: true
80      - uses: dtolnay/rust-toolchain@stable
81      - uses: dtolnay/install@reindeer
82      - uses: dtolnay/install@buck2
83      - name: Install lld
84        run: sudo apt-get install lld
85      - run: cargo vendor --versioned-dirs --locked
86        working-directory: third-party
87      - run: reindeer buckify
88        working-directory: third-party
89      - name: Check reindeer-generated BUCK file up to date
90        run: git diff --exit-code
91      - run: buck2 run demo
92      - run: buck2 build ...
93      - run: buck2 run tests:test
94
95  bazel:
96    name: Bazel
97    runs-on: ubuntu-latest
98    if: github.event_name != 'pull_request'
99    timeout-minutes: 45
100    steps:
101      - uses: actions/checkout@v3
102      - name: Install Bazel
103        run: |
104          wget -q -O install.sh https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-installer-linux-x86_64.sh
105          chmod +x install.sh
106          ./install.sh --user
107          echo $HOME/bin >> $GITHUB_PATH
108      - name: Install lld
109        run: sudo apt-get install lld
110      - run: bazel run demo --verbose_failures --noshow_progress
111      - run: bazel test ... --verbose_failures --noshow_progress
112
113  clippy:
114    name: Clippy
115    runs-on: ubuntu-latest
116    if: github.event_name != 'pull_request'
117    timeout-minutes: 45
118    steps:
119      - uses: actions/checkout@v3
120      - uses: dtolnay/rust-toolchain@clippy
121      - run: cargo clippy --workspace --tests -- -Dclippy::all
122
123  clang-tidy:
124    name: Clang Tidy
125    runs-on: ubuntu-latest
126    if: github.event_name != 'pull_request'
127    timeout-minutes: 45
128    steps:
129      - uses: actions/checkout@v3
130      - name: Install clang-tidy
131        run: sudo apt-get install clang-tidy-11
132      - name: Run clang-tidy
133        run: clang-tidy-11 src/cxx.cc --warnings-as-errors=*
134
135  outdated:
136    name: Outdated
137    runs-on: ubuntu-latest
138    if: github.event_name != 'pull_request'
139    timeout-minutes: 45
140    steps:
141      - uses: actions/checkout@v3
142      - uses: dtolnay/install@cargo-outdated
143      - run: cargo outdated --workspace --exit-code 1
144