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