Refactor and use pallas nonce #219
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: x86_64-apple-darwin } | |
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 | |
run: cargo install cross | |
- name: Run cargo check | |
run: cargo check | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Run cargo clippy | |
run: cross clippy --release --target ${{ matrix.job.target }} -- -D warnings | |
- name: Run cargo test | |
run: cross test --release --target ${{ matrix.job.target }} | |
- name: Build Release | |
run: cross 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@v2 | |
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 }} |