Skip to content

update actions

update actions #82

Workflow file for this run

name: CI
on:
push:
branches:
- 'master'
tags:
- 'v*.*.*'
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build rust ${{ matrix.platform.target }}/${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
# mac target
- { os: 'macos-latest', target: 'x86_64-apple-darwin', arch: 'x86_64', osn: 'mac', tests_integration: true }
- { os: 'macos-latest', target: 'aarch64-apple-darwin', arch: 'aarch64', osn: 'mac', tests_integration: false }
# linux target
- { os: 'ubuntu-latest', target: 'x86_64-unknown-linux-musl', arch: 'x86_64', osn: 'ubuntu-latest', tests_integration: true }
- { os: 'ubuntu-latest', target: 'aarch64-unknown-linux-musl', arch: 'aarch64', osn: 'ubuntu-latest', tests_integration: true }
steps:
- name: Set release version in environment
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Run tests
uses: clechasseur/rs-cargo@v2
if: ${{ matrix.platform.tests_integration == true }}
with:
use-cross: true
command: test
args: --target ${{ matrix.platform.target }} --bin vault
- name: Compile
uses: clechasseur/rs-cargo@v2
with:
use-cross: true
command: build
args: --release --target ${{ matrix.platform.target }} --bin vault
- name: Copy artifacts
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir -p artifact
cp target/${{ matrix.platform.target }}/release/vault artifact/vault-${{ env.RELEASE_VERSION }}-${{ matrix.platform.target }}
cp target/${{ matrix.platform.target }}/release/vault artifact/vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
- name: Prepare output artifact for next step
uses: actions/upload-artifact@v4
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
name: vault-${{ env.RELEASE_VERSION }}-${{ matrix.platform.target }}
path: artifact/vault-${{ env.RELEASE_VERSION }}-${{ matrix.platform.target }}
- name: Prepare output artifact for next step
uses: actions/upload-artifact@v4
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
name: vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
path: artifact/vault_${{ matrix.platform.osn }}_${{ matrix.platform.arch }}
release:
runs-on: 'ubuntu-latest'
needs: [ "build" ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Release
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
files: |
binaries/*/*