Skip to content

Feat/composing matching rules #509

Feat/composing matching rules

Feat/composing matching rules #509

Workflow file for this run

name: Release workflow
on:
release:
types:
- published
pull_request:
branches:
- master
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
jobs:
build-release:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
include:
- operating-system: ubuntu-20.04
targets: x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl
- operating-system: windows-2019
targets: aarch64-pc-windows-msvc,x86_64-pc-windows-msvc
- operating-system: macos-12
targets: aarch64-apple-darwin,x86_64-apple-darwin
fail-fast: false
env:
pact_do_not_track: true
steps:
- uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.targets }}
- name: Rust caching
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v3
- name: Platform abbreviation
id: platform-abbreviation
shell: bash
run: |
if [[ "${{ runner.os }}" = "Linux" ]]; then
echo "platform=linux" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" = "Windows" ]]; then
echo "platform=win" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" = "macOS" ]]; then
echo "platform=macos" >> "$GITHUB_OUTPUT"
else
echo "Unknown platform"
exit 1
fi
- name: Cargo flags
id: cargo-flags
shell: bash
run: |
if [[ "${{ github.event_name }}" = "release" ]]; then
echo "flags=--release" >> "$GITHUB_OUTPUT"
else
echo "flags=" >> "$GITHUB_OUTPUT"
fi
- name: Build mock server CLI
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
startsWith(github.ref, 'refs/tags/pact_mock_server_cli')
shell: bash
run: |
./release-${{ steps.platform-abbreviation.outputs.platform }}.sh \
${{ steps.cargo-flags.outputs.flags }}
working-directory: rust/pact_mock_server_cli
- name: Build verifier CLI
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
startsWith(github.ref, 'refs/tags/pact_verifier_cli')
shell: bash
run: |
./release-${{ steps.platform-abbreviation.outputs.platform }}.sh \
${{ steps.cargo-flags.outputs.flags }}
working-directory: rust/pact_verifier_cli
- name: Build FFI library
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
startsWith(github.ref, 'refs/tags/libpact_ffi')
shell: bash
run: |
./release-${{ steps.platform-abbreviation.outputs.platform }}.sh \
${{ steps.cargo-flags.outputs.flags }}
working-directory: rust/pact_ffi
- name: Upload the artifacts
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@v4
with:
name: release-artifacts-${{ matrix.operating-system }}
path: rust/release_artifacts
if-no-files-found: error
publish:
runs-on: ubuntu-latest
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')
needs: build-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: release-artifacts-*
path: rust/release_artifacts
merge-multiple: true
- name: Upload Release Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: rust/release_artifacts/*
file_glob: true
tag: ${{ github.ref }}