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