diff --git a/.github/workflows/build-ffi.yml b/.github/workflows/build-ffi.yml index e3693379b..a75575cdd 100644 --- a/.github/workflows/build-ffi.yml +++ b/.github/workflows/build-ffi.yml @@ -6,22 +6,23 @@ jobs: build: runs-on: ${{ matrix.operating-system }} strategy: + fail-fast: false matrix: operating-system: [ ubuntu-latest, windows-latest, macos-latest ] rust: [ stable ] env: pact_do_not_track: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: rustc --version || true shell: bash - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ matrix.rust }} + toolchain: stable - name: Install shared mime info DB if: runner.os == 'macOS' run: brew install shared-mime-info - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@nightly with: toolchain: nightly components: rustfmt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 736bba59d..4c14b47b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,37 +12,31 @@ jobs: env: pact_do_not_track: true steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ matrix.rust }} + toolchain: stable components: clippy - name: Install shared mime info DB if: runner.os == 'macOS' run: brew install shared-mime-info - name: Tests - uses: marcopolo/cargo@master # TODO: - use actions-rs/cargo@v1 when PR merged https://github.com/actions-rs/cargo/pull/59 - with: - working-directory: rust - command: test + run: cargo test + working-directory: rust env: RUST_LOG: debug RUST_BACKTRACE: 1 - name: Build Components - uses: marcopolo/cargo@master - with: - working-directory: rust - command: build + run: cargo build + working-directory: rust - name: Clippy if: runner.os == 'Linux' - uses: marcopolo/cargo@master - with: - working-directory: rust - command: clippy + run: cargo clippy + working-directory: rust musl-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: | docker run --rm --user "$(id -u)":"$(id -g)" -v $(pwd):/workspace -w /workspace/rust -t -e TZ=UTC pactfoundation/rust-musl-build ./scripts/ci-musl-build.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed23e3c38..02f4c3c2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,17 +13,25 @@ jobs: env: pact_do_not_track: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install stable Rust toolchain - uses: actions-rs/toolchain@v1 + if: runner.os == 'Linux' + uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true - target: aarch64-apple-darwin - - name: Install LLVM - run: choco install -y llvm + targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-musl + - name: Install stable Rust toolchain if: runner.os == 'Windows' + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + targets: aarch64-pc-windows-msvc,x86_64-pc-windows-msvc + - name: Install stable Rust toolchain + if: runner.os == 'MacOS' + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + targets: aarch64-apple-darwin,x86_64-apple-darwin - if: startsWith(github.ref, 'refs/tags/pact_mock_server_cli') && runner.os == 'Linux' run: ./release-linux.sh working-directory: rust/pact_mock_server_cli @@ -46,9 +54,6 @@ jobs: run: ./release-osx.sh shell: bash working-directory: rust/pact_verifier_cli - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - if: startsWith(github.ref, 'refs/tags/libpact_ffi') && runner.os == 'Linux' run: ./release-linux.sh working-directory: rust/pact_ffi @@ -61,13 +66,14 @@ jobs: shell: bash working-directory: rust/pact_ffi - name: Upload the artifacts - uses: actions/upload-artifact@v1 + if: startsWith(github.ref, 'refs/tags/libpact_ffi') || startsWith(github.ref, 'refs/tags/pact_verifier_cli') || startsWith(github.ref, 'refs/tags/pact_mock_server_cli') + uses: actions/upload-artifact@v3.1.2 with: name: release-artifacts path: rust/target/artifacts - name: Upload Release Assets - id: upload-release-asset - uses: svenstaro/upload-release-action@v2 + if: startsWith(github.ref, 'refs/tags/libpact_ffi') || startsWith(github.ref, 'refs/tags/pact_verifier_cli') || startsWith(github.ref, 'refs/tags/pact_mock_server_cli') + uses: svenstaro/upload-release-action@2.5.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: rust/target/artifacts/* diff --git a/rust/pact_ffi/CMakeLists.txt b/rust/pact_ffi/CMakeLists.txt index 84fa0c9fd..bc751ce04 100644 --- a/rust/pact_ffi/CMakeLists.txt +++ b/rust/pact_ffi/CMakeLists.txt @@ -273,7 +273,7 @@ set_source_files_properties( add_custom_command( OUTPUT ${CBINDGEN_HEADER_FILE} COMMAND - rustup run nightly-2022-12-01 + rustup run nightly ${CBINDGEN_EXECUTABLE} --config ${CBINDGEN_CONFIG_FILE} --crate ${CRATE_NAME} diff --git a/rust/pact_ffi/ci-build.sh b/rust/pact_ffi/ci-build.sh index 6283fa2fe..209e0b674 100755 --- a/rust/pact_ffi/ci-build.sh +++ b/rust/pact_ffi/ci-build.sh @@ -8,7 +8,7 @@ rustc --version cargo install --force cbindgen rm -rf ./include -rustup toolchain install nightly-2022-12-01 +rustup toolchain install nightly echo ------------------------------------- echo - Build library with CMake @@ -22,11 +22,11 @@ cd .. echo ------------------------------------- echo - Generate header with cbindgen echo ------------------------------------- -rustup run nightly-2022-12-01 cbindgen \ +rustup run nightly cbindgen \ --config cbindgen.toml \ --crate pact_ffi \ --output include/pact.h -rustup run nightly-2022-12-01 cbindgen \ +rustup run nightly cbindgen \ --config cbindgen-c++.toml \ --crate pact_ffi \ --output include/pact-c++.h diff --git a/rust/pact_ffi/release-linux.sh b/rust/pact_ffi/release-linux.sh index 21372e34b..b62b5b265 100755 --- a/rust/pact_ffi/release-linux.sh +++ b/rust/pact_ffi/release-linux.sh @@ -17,13 +17,13 @@ gzip -c ../target/release/libpact_ffi.a > ../target/artifacts/libpact_ffi-linux- openssl dgst -sha256 -r ../target/artifacts/libpact_ffi-linux-x86_64.a.gz > ../target/artifacts/libpact_ffi-linux-x86_64.a.gz.sha256 echo -- Generate the header files -- -rustup toolchain install nightly-2022-12-01 -rustup component add rustfmt --toolchain nightly-2022-12-01 -rustup run nightly-2022-12-01 cbindgen \ +rustup toolchain install nightly +rustup component add rustfmt --toolchain nightly +rustup run nightly cbindgen \ --config cbindgen.toml \ --crate pact_ffi \ --output include/pact.h -rustup run nightly-2022-12-01 cbindgen \ +rustup run nightly cbindgen \ --config cbindgen-c++.toml \ --crate pact_ffi \ --output include/pact-cpp.h