diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 31eb3437351..1891ed1aad9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -18,6 +18,19 @@ on: branches: [ main ] pull_request: branches: '*' + workflow_dispatch: + inputs: + nightly: + description: "Test on latest nightly" + required: true + default: false + type: boolean + schedule: + # Run nightly cronjob CI every day at 14 UTC / 6AM PST / 3PM CET + - cron: '0 14 * * *' + +env: + INSTALLED_NIGHTLY_VERSION: nightly-2022-04-05 jobs: @@ -26,6 +39,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -65,6 +85,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Get cargo-make version @@ -100,6 +127,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Get cargo-make version @@ -145,6 +179,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Get cargo-make version @@ -177,6 +218,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Attempt to load cached CLDR source data @@ -227,17 +275,24 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Load cortex target for no_std build. run: | - rustup install nightly-2022-04-05 - rustup component add --toolchain nightly-2022-04-05 rust-src - rustup target add thumbv7m-none-eabi --toolchain nightly-2022-04-05 - rustup target add thumbv8m.main-none-eabihf --toolchain nightly-2022-04-05 - rustup target add x86_64-unknown-linux-gnu --toolchain nightly-2022-04-05 - rustup target add wasm32-unknown-unknown --toolchain nightly-2022-04-05 + rustup install $INSTALLED_NIGHTLY_VERSION + rustup component add --toolchain $INSTALLED_NIGHTLY_VERSION rust-src + rustup target add thumbv7m-none-eabi --toolchain $INSTALLED_NIGHTLY_VERSION + rustup target add thumbv8m.main-none-eabihf --toolchain $INSTALLED_NIGHTLY_VERSION + rustup target add x86_64-unknown-linux-gnu --toolchain $INSTALLED_NIGHTLY_VERSION + rustup target add wasm32-unknown-unknown --toolchain $INSTALLED_NIGHTLY_VERSION - name: Set up Clang-14 run: | @@ -291,6 +346,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Load nightly for rustdoc-json @@ -363,6 +425,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -388,9 +457,9 @@ jobs: - name: Load wasi for gn. run: | - rustup install nightly-2022-04-05 - rustup component add --toolchain nightly-2022-04-05 rust-src - rustup target add wasm32-wasi --toolchain nightly-2022-04-05 + rustup install $INSTALLED_NIGHTLY_VERSION + rustup component add --toolchain $INSTALLED_NIGHTLY_VERSION rust-src + rustup target add wasm32-wasi --toolchain $INSTALLED_NIGHTLY_VERSION - name: Attempt to load cached GN Third-Party Tools uses: actions/cache@v3 @@ -424,6 +493,13 @@ jobs: needs: [check] steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show - name: Install cargo-all-features @@ -465,12 +541,19 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load nightly Rust toolchain for WASM. run: | - rustup install nightly-2022-04-05 - rustup target add wasm32-unknown-unknown --toolchain nightly-2022-04-05 - rustup target add wasm32-unknown-emscripten --toolchain nightly-2022-04-05 - rustup component add rust-src --toolchain nightly-2022-04-05 + rustup install $INSTALLED_NIGHTLY_VERSION + rustup target add wasm32-unknown-unknown --toolchain $INSTALLED_NIGHTLY_VERSION + rustup target add wasm32-unknown-emscripten --toolchain $INSTALLED_NIGHTLY_VERSION + rustup component add rust-src --toolchain $INSTALLED_NIGHTLY_VERSION - name: Get cargo-make version id: cargo-make-version @@ -514,7 +597,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -555,7 +644,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -610,10 +705,11 @@ jobs: # Clippy job (cargo-clippy) - completes and puts warnings inline in PR clippy: runs-on: ubuntu-latest - + # We don't expect to keep being clippy-clean on nightly Rust + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -631,6 +727,7 @@ jobs: # Benchmarking & dashboards job benchmark: + # We don't expect to keep being clippy-clean on nightly Rust strategy: # max-parallel: 1 fail-fast: false @@ -655,6 +752,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV - name: Load the default Rust toolchain via the rust-toolchain file. run: rustup show @@ -774,17 +878,23 @@ jobs: steps: - uses: actions/checkout@v2 - + - name: Potentially override rust version with nightly + # pull_request is a fake for me to be able to test this for now + if: "github.event_name == 'schedule' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.nightly)" + run: | + rustup override set nightly + echo "ICU4X_NIGHTLY_TOOLCHAIN=nightly" >> $GITHUB_ENV + echo "INSTALLED_NIGHTLY_VERSION=nightly" >> $GITHUB_ENV # Nightly is only needed for the `--profile bench` line. Once that is stabilized, # then this line is no longer needed. - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2022-04-05 + toolchain: ${{ env.INSTALLED_NIGHTLY_VERSION }} override: true - name: Run the example with dhat-rs to collect memory information run: | - cargo run --package icu_benchmark_memory -- --os ${{ matrix.os }} ${{ matrix.examples }} --toolchain nightly-2022-04-05 + cargo run --package icu_benchmark_memory -- --os ${{ matrix.os }} ${{ matrix.examples }} --toolchain $INSTALLED_NIGHTLY_VERSION # Benchmarking & dashboards job > (unmerged PR only) Convert benchmark output into # dashboard HTML in a commit of a branch of the local repo. @@ -881,8 +991,8 @@ jobs: - name: Install prerequisites for wasm build run: | rustup toolchain list - rustup toolchain install nightly-2022-04-05 - rustup component add --toolchain nightly-2022-04-05 rust-src + rustup toolchain install $INSTALLED_NIGHTLY_VERSION + rustup component add --toolchain $INSTALLED_NIGHTLY_VERSION rust-src - name: Install Node.js v16.18.0 uses: actions/setup-node@v3