From 68411e027ee4aab1dd974637daf975e0f2a52caa Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Wed, 18 Oct 2023 11:29:17 +0200 Subject: [PATCH] chore: run all jobs on GitHub For aarch64 we were still using CircleCI, now run all jobs on GitHub. Also improve the CI a bit: - determine MSRV automatically from the Cargo.toml file - Update/replace deprecated GitHub actions --- .circleci/config.yml | 27 ------- .github/workflows/ci.yml | 156 +++++++++++++++++---------------------- 2 files changed, 69 insertions(+), 114 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 18ac8d5..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: 2 -jobs: - test_arm: - machine: - image: ubuntu-2004:202101-01 - resource_class: arm.large - steps: - - checkout - - run: - name: Install Rust - command: | - curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain $(cat rust-toolchain) -y - - run: - name: Run cargo test pairing,multicore - command: cargo test --no-default-features --features pairing,multicore - - run: - name: Run cargo test blst,multicore - command: cargo test --release --no-default-features --features blst,multicore - - run: - name: Run cargo test blst,multicore,blst-portable - command: cargo test --release --no-default-features --features blst,multicore,blst-portable - -workflows: - version: 2 - test_all: - jobs: - - test_arm diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59344aa..878d3b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,6 @@ on: branches: master env: - MSRV: 1.67.1 RUSTFLAGS: "-Dwarnings" CARGO_INCREMENTAL: 0 RUST_BACKTRACE: 1 @@ -15,47 +14,50 @@ jobs: set-msrv: runs-on: ubuntu-latest outputs: - msrv: ${{ steps.msrv.outputs.msrv }} + msrv: ${{ steps.msrv.outputs.MSRV }} steps: - - uses: actions/checkout@v2 - - id: msrv - run: echo "::set-output name=msrv::$(echo $MSRV)" + - uses: actions/checkout@v4 + - name: Extract MSRV from Cargo.toml + id: msrv + run: | + MSRV=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].rust_version') + echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT" # NOTE vmx 2022-06-14: currently doesn't work, hence run it on CircleCI # for now. - #linux_foreign: - # strategy: - # matrix: - # include: - # # 64-bit Linux/arm64 - # - target: aarch64-unknown-linux-gnu - # rust: nightly - # arch: aarch64 - # - # runs-on: ubuntu-18.04 - # steps: - # - uses: actions/checkout@v2 - # - uses: uraimo/run-on-arch-action@v2.1.1 - # name: Run commands - # id: runcmd - # with: - # arch: aarch64 - # distro: ubuntu18.04 - # - # # Not required, but speeds up builds by storing container images in - # # a GitHub package registry. - # githubToken: ${{ github.token }} - # - # install: | - # apt-get update -q -y - # apt-get install -q -y ocl-icd-opencl-dev curl build-essential - # curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.rust }} -y - # source $HOME/.cargo/env - # - # run: | - # $HOME/.cargo/bin/cargo test --release --no-default-features --features pairing,multicore --target ${{ matrix.target }} - # $HOME/.cargo/bin/cargo test --release --no-default-features --features blst,multicore --target ${{ matrix.target }} - # $HOME/.cargo/bin/cargo test --release --no-default-features --features blst,multicore,blst-portable --target ${{ matrix.target }} + linux_foreign: + strategy: + matrix: + include: + # 64-bit Linux/arm64 + - target: aarch64-unknown-linux-gnu + toolchain: nightly + arch: aarch64 + + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v2.5.1 + name: Run commands + id: runcmd + with: + arch: aarch64 + distro: ubuntu18.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + install: | + apt-get update -q -y + apt-get install -q -y ocl-icd-opencl-dev curl build-essential git + curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y + source $HOME/.cargo/env + + run: | + $HOME/.cargo/bin/cargo test --config net.git-fetch-with-cli=true --release --no-default-features --features pairing,multicore --target ${{ matrix.target }} + $HOME/.cargo/bin/cargo test --config net.git-fetch-with-cli=true --release --no-default-features --features blst,multicore --target ${{ matrix.target }} + $HOME/.cargo/bin/cargo test --config net.git-fetch-with-cli=true --release --no-default-features --features blst,multicore,blst-portable --target ${{ matrix.target }} # Linux tests linux: @@ -65,27 +67,25 @@ jobs: include: # 32-bit Linux/x86 - target: i686-unknown-linux-gnu - rust: ${{needs.set-msrv.outputs.msrv}} + toolchain: ${{needs.set-msrv.outputs.msrv}} deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu - rust: stable + toolchain: stable deps: sudo apt update && sudo apt install gcc-multilib # 64-bit Linux/x86_64 - target: x86_64-unknown-linux-gnu - rust: ${{needs.set-msrv.outputs.msrv}} + toolchain: ${{needs.set-msrv.outputs.msrv}} - target: x86_64-unknown-linux-gnu - rust: stable + toolchain: stable runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true + - uses: actions/checkout@v4 + - name: Install the Rust toolchain + run: | + rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.target }} --profile minimal --no-self-update + rustup override set ${{ matrix.toolchain }} - name: Install opencl run: sudo apt-get install -y ocl-icd-opencl-dev - run: ${{ matrix.deps }} @@ -108,13 +108,11 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.toolchain }} - target: x86_64-apple-darwin - override: true + - uses: actions/checkout@v4 + - name: Install the Rust toolchain + run: | + rustup toolchain install ${{ matrix.toolchain }} --target x86_64-apple-darwin --profile minimal --no-self-update + rustup override set ${{ matrix.toolchain }} - run: cargo test --no-default-features --features pairing,multicore - run: cargo test --no-default-features --features pairing - run: cargo test --no-default-features --features blst @@ -130,17 +128,15 @@ jobs: include: # 64-bit Windows (MSVC) - target: x86_64-pc-windows-msvc - toolchain: stable + toolchain: ${{needs.set-msrv.outputs.msrv}} runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - override: true + - uses: actions/checkout@v4 + - name: Install the Rust toolchain + run: | + rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.target }} --profile minimal --no-self-update + rustup override set ${{ matrix.toolchain }} - uses: msys2/setup-msys2@v2 - run: cargo test --target ${{ matrix.target }} --no-default-features --features pairing,multicore - run: cargo test --target ${{ matrix.target }} --no-default-features --features pairing @@ -152,38 +148,24 @@ jobs: clippy_check_blst: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - run: rustup component add clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --no-default-features --features blst,multicore + - name: Run Clippy + run: cargo clippy --workspace --no-default-features --features blst,multicore -- -D warnings clippy_check_pairing: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - run: rustup component add clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - name: Run Clippy + run: cargo clippy --workspace -- -D warnings check_fmt_and_docs: name: Checking fmt and docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - - name: setup - run: | - rustup component add rustfmt - rustc --version - - name: fmt + - uses: actions/checkout@v4 + - run: rustup component add rustfmt + - name: Run cargo fmt run: cargo fmt --all -- --check