Skip to content

Refactor and use pallas nonce #221

Refactor and use pallas nonce

Refactor and use pallas nonce #221

Workflow file for this run

# 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: x86_64-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
run: cargo check
- name: Run cargo fmt
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)
PKG_SUFFIX=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_SUFFIX=".zip" ;; esac;
PKG_NAME=${PROJECT_NAME}-${PROJECT_VERSION}-${{ matrix.job.label }}-${{ matrix.job.target }}${PKG_SUFFIX}
case ${{ matrix.job.target }} in
*-pc-windows-*) 7z -y a "${PKG_NAME}" ./target/${{matrix.job.target}}/release/cncli.exe | tail -2 ;;
*) tar -C target/${{matrix.job.target}}/release -czf "${PKG_NAME}" cncli ;;
esac;
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 }}