Skip to content

Merge pull request #48 from spacemeshos/dependabot/cargo/clap-4.5.18 #126

Merge pull request #48 from spacemeshos/dependabot/cargo/clap-4.5.18

Merge pull request #48 from spacemeshos/dependabot/cargo/clap-4.5.18 #126

Workflow file for this run

on:
pull_request:
push:
branches:
- main
tags:
- 'v*'
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace --all-features
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: stable
- uses: clechasseur/rs-clippy-check@v3
build:
name: Build library
runs-on: ${{ matrix.os }}
needs:
- check
- fmt
- clippy
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact-name: linux
- os: ubuntu-latest-arm-8-cores
artifact-name: linux-arm64
- os: [self-hosted, macos, arm64]
artifact-name: macos-arm64
- os: macos-13
artifact-name: macos
- os: windows-2022
artifact-name: windows
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
key: ${{ join( matrix.os, '-' ) }}
- name: Build
run: cargo build --release
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: quicksync-${{ matrix.artifact-name }}
path: |
target/release/quicksync${{ matrix.os == 'windows-2022' && '.exe' || '' }}
if-no-files-found: error
test:
runs-on: ${{ matrix.os }}
needs:
- check
- fmt
- clippy
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- ubuntu-latest-arm-8-cores
- macos-13
- [self-hosted, macos, arm64]
- windows-2022
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/[email protected]
- run: cargo test
coverage:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/[email protected]
- run: cargo install cargo-tarpaulin
- name: Run coverage
run: cargo tarpaulin --exclude-files src/main.rs --out Lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
name: Publish release
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List artifacts
run: ls -R ./artifacts
- name: Create a draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Pack artifacts
run: >
mkdir ./assets;
for dir in ./artifacts/*/; do
zip -o -j -r "./assets/$(basename "$dir")-$TAG.zip" "$dir";
done
env:
TAG: ${{ github.ref_name }}
- name: Upload Release Assets
run: gh release upload $TAG ./assets/*.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}