Refactor and use pallas nonce #226
Workflow file for this run
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
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md | |
on: | |
push: { } | |
name: Validate | |
jobs: | |
build: | |
name: Build | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { os: ubuntu-22.04, label: ubuntu22, target: x86_64-unknown-linux-gnu } | |
- { os: ubuntu-22.04, label: ubuntu22, target: x86_64-unknown-linux-musl, use-cross: true } | |
- { os: macos-latest, label: macos, target: aarch64-apple-darwin } | |
- { os: windows-latest, label: windows, target: x86_64-pc-windows-msvc } | |
rust: [ stable ] | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt, clippy | |
- name: Install cross | |
if: ${{ matrix.job.use-cross }} | |
run: cargo install cross | |
- name: Run cargo check | |
if: ${{ matrix.job.target == 'x86_64-unknown-linux-gnu' }} | |
run: cargo check | |
- name: Run cargo fmt | |
if: ${{ matrix.job.target == 'x86_64-unknown-linux-gnu' }} | |
run: cargo fmt --all -- --check | |
- name: Run cargo clippy (cross) | |
if: ${{ matrix.job.use-cross }} | |
run: cross clippy --release --target ${{ matrix.job.target }} -- -D warnings | |
- name: Run cargo clippy | |
if: ${{ !matrix.job.use-cross }} | |
run: cargo clippy --release --target ${{ matrix.job.target }} -- -D warnings | |
- name: Run cargo test (cross) | |
if: ${{ matrix.job.use-cross }} | |
run: cross test --release --target ${{ matrix.job.target }} | |
- name: Run cargo test | |
if: ${{ !matrix.job.use-cross }} | |
run: cargo test --release --target ${{ matrix.job.target }} | |
- name: Build Release (cross) | |
if: ${{ matrix.job.use-cross }} | |
run: cross build --release --target ${{ matrix.job.target }} --locked | |
- name: Build Release | |
if: ${{ !matrix.job.use-cross }} | |
run: cargo build --release --target ${{ matrix.job.target }} --locked | |
- name: Package | |
id: package | |
run: | | |
PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml) | |
PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1) | |
if [[ "${{ matrix.job.target }}" == *-pc-windows-* ]]; then | |
PKG_SUFFIX=".zip" | |
else | |
PKG_SUFFIX=".tar.gz" | |
fi | |
PKG_NAME=${PROJECT_NAME}-${PROJECT_VERSION}-${{ matrix.job.label }}-${{ matrix.job.target }}${PKG_SUFFIX} | |
if [[ "${{ matrix.job.target }}" == *-pc-windows-* ]]; then | |
7z -y a "${PKG_NAME}" ./target/${{matrix.job.target}}/release/cncli.exe | tail -2 | |
else | |
tar -C target/${{matrix.job.target}}/release -czf "${PKG_NAME}" cncli | |
fi | |
echo ::set-output name=PKG_NAME::${PKG_NAME} | |
echo ::set-output name=PKG_PATH::${PKG_NAME} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.package.outputs.PKG_NAME }} | |
path: ${{ steps.package.outputs.PKG_PATH }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
prerelease: "${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}" | |
files: ${{ steps.package.outputs.PKG_PATH }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |