Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reduce ci usage #480

Merged
merged 7 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions .github/workflows/build-ffi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
name: Pact-Rust FFI Build

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove that, that would be annoying. Imagine waiting for a build, then someone else pushes a commit.

Copy link
Contributor Author

@JP-Ellis JP-Ellis Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concurrency group is per-PR, or per branch in the case of a push trigger (which would only happen in master).

So two PRs can have CI running concurrently with no issue; and if two PRs merge in quick succession, the second merge will cancel the first. But once merged, there shouldn't be any waiting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there should not be a case of waiting for a build, and it being canceled by someone else's push except if you are both working on the same PR.

If you want this to run specifically when creating tagged released, I recommend creating a separate trigger for tags.


env:
RUST_BACKTRACE: "1"
RUST_LOG: "debug"
PACT_DO_NOT_TRACK: "true"
CARGO_TERM_COLOR: always

jobs:
build:
Expand All @@ -10,22 +26,21 @@ jobs:
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
rust: [ stable ]
env:
pact_do_not_track: true
steps:
- uses: actions/checkout@v3
- run: rustc --version || true
shell: bash
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
shared-key: ${{ runner.os }}
- name: Install shared mime info DB
if: runner.os == 'macOS'
run: brew install shared-mime-info
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
components: rustfmt
- name: Install doxygen
if: runner.os == 'Linux'
run: sudo apt-get install -y doxygen
Expand Down
55 changes: 38 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
name: Pact-Rust Build

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

env:
RUST_BACKTRACE: "1"
RUST_LOG: "debug"
PACT_DO_NOT_TRACK: "true"
CARGO_TERM_COLOR: always

jobs:
build:
Expand All @@ -10,31 +26,23 @@ jobs:
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
rust: [ stable ]
env:
pact_do_not_track: true
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Install shared mime info DB
if: runner.os == 'macOS'
run: brew install shared-mime-info
- name: Tests
run: cargo test
run: cargo nextest run
working-directory: rust
env:
RUST_LOG: debug
RUST_BACKTRACE: 1
- name: Run mock_server_logs test
run: cargo test -p pact_ffi returns_mock_server_logs -- --nocapture --include-ignored
working-directory: rust
env:
RUST_LOG: debug
RUST_BACKTRACE: 1
- name: Build Components
run: cargo build
run: cargo nextest run -p pact_ffi returns_mock_server_logs -- --include-ignored
working-directory: rust
- name: Clippy
if: runner.os == 'Linux'
Expand All @@ -43,10 +51,24 @@ jobs:

musl-build:
runs-on: ubuntu-latest
container:
image: pactfoundation/rust-musl-build
steps:
- 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
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
shared-key: ${{ runner.os }}-musl
- name: Tests
run: cargo nextest run
working-directory: rust


check-features:
Expand All @@ -55,4 +77,3 @@ jobs:
- uses: actions/checkout@v3
- run: cargo check --no-default-features
working-directory: rust

70 changes: 29 additions & 41 deletions .github/workflows/compatability-suite.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,44 @@
name: Pact-Rust Compatibility Suite

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

env:
pact_do_not_track: true
RUST_BACKTRACE: "1"
RUST_LOG: "debug"
PACT_DO_NOT_TRACK: "true"
CARGO_TERM_COLOR: always

jobs:
v1:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Run Cucumber
run: cargo test --test v1*
working-directory: compatibility-suite
v2:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Run Cucumber
run: cargo test --test v2*
working-directory: compatibility-suite
v3:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Run Cucumber
run: cargo test --test v3*
working-directory: compatibility-suite
v4:
compatibility-suite:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
operating-system: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
rust
compatibility-suite
shared-key: ${{ runner.os }}
- name: Run Cucumber
run: cargo test --test v4*
# Note: cucumber's test executables are incompatible with nextest
# See: https://github.com/nextest-rs/nextest/issues/1329
run: cargo test
working-directory: compatibility-suite
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

env:
RUST_BACKTRACE: "1"
RUST_LOG: "debug"
PACT_DO_NOT_TRACK: "true"
CARGO_TERM_COLOR: always

jobs:
build-release:
name: build-release (${{ matrix.targets }})
Expand All @@ -43,9 +49,6 @@ jobs:
targets: aarch64-apple-darwin
fail-fast: false

env:
pact_do_not_track: true

steps:
- uses: actions/checkout@v4

Expand All @@ -59,10 +62,10 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
key: ${{ matrix.targets }}
shared-key: ${{ runner.os }}

- name: Set up QEMU
if: runner.os == 'Linux'
if: runner.os == 'Linux' && startsWith(matrix.targets, 'aarch64')
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
Expand Down
Loading