Add CI concurrency group #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_call: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
complete: | |
if: always() | |
needs: [cargo] | |
runs-on: ubuntu-latest | |
steps: | |
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 | |
cargo: | |
strategy: | |
fail-fast: false | |
matrix: | |
crate: | |
- name: cargo-workspaces | |
version: '0.2.35' | |
- name: cargo-workspaces | |
version: '0.3.4' | |
- name: cargo-hack | |
version: '0.5.28' | |
- name: cargo-set-rust-version | |
version: '0.5.0' | |
- name: cargo-edit | |
version: '0.11.6' | |
- name: cargo-fuzz | |
version: '0.12.0' | |
- name: soroban-cli | |
version: '20.0.0-rc.4.1' | |
- name: cargo-readme | |
version: '3.3.1' | |
- name: cargo-semver-checks | |
version: '0.32.0' | |
- name: cargo-public-api | |
version: '0.33.1' | |
- name: wasm-pack | |
version: '0.12.1' | |
- name: wasm-bindgen-cli | |
version: '0.2.92' | |
- name: check-lockfile-intersection | |
version: '0.1.0' | |
- name: wasm-cs | |
version: '1.0.0' | |
runs-on: | |
- ubuntu-latest | |
- macos-12 # amd64 | |
- macos-14 # arm64 | |
- windows-latest | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v3 | |
- shell: bash | |
run: rustup update | |
- uses: stellar/actions/rust-cache@main | |
- shell: bash | |
run: cargo install --target-dir ~/.cargo/target --root . --locked --version ${{ matrix.crate.version }} ${{ matrix.crate.name }} | |
- shell: bash | |
run: tar cvfz ${{ matrix.crate.name }}-${{ matrix.crate.version }}-${{ runner.os }}-${{ runner.arch }}.tar.gz -C bin . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.crate.name }}-${{ matrix.crate.version }}-${{ matrix.runs-on }} | |
path: '*.tar.gz' | |
release-create: | |
if: github.ref_name == 'main' | |
needs: complete | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- id: set-tag | |
run: echo "tag=v$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT | |
- run: gh release -R ${{ github.repository }} create --generate-notes --target ${{ github.sha }} "${{ steps.set-tag.outputs.tag }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
tag: ${{ steps.set-tag.outputs.tag }} | |
release-upload: | |
if: github.ref_name == 'main' | |
needs: release-create | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- run: gh release -R ${{ github.repository }} upload --clobber "${{ needs.release-create.outputs.tag }}" **/*.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |