Skip to content

Fix issue #385 (#386) #648

Fix issue #385 (#386)

Fix issue #385 (#386) #648

Workflow file for this run

name: Rust
on:
push:
branches:
- master
tags:
- "**"
pull_request:
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@c449d86cf33a2a6c7a4193264cc2578e2c3266d4 # pin@v4
with:
paths_ignore: '["docs/**", "*.md"]'
build-linux-x64:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
name: Linux x86_64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Build
run: cargo build --target x86_64-unknown-linux-gnu --release && mv target/x86_64-unknown-linux-gnu/release/squawk target/release/squawk-linux-x64
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: release
path: target/release/squawk-linux-x64
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/squawk-linux-x64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-linux-arm64:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
name: Linux arm64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apt
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
profile: minimal
override: true
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Build
run: RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo build --target aarch64-unknown-linux-gnu --release && mv target/aarch64-unknown-linux-gnu/release/squawk target/release/squawk-linux-arm64
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: release
path: target/release/squawk-linux-arm64
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/squawk-linux-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-windows:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
name: Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
with:
toolchain: stable
target: x86_64-pc-windows-msvc
profile: minimal
override: true
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Build
run: cargo build --target x86_64-pc-windows-msvc --release && mv target/x86_64-pc-windows-msvc/release/squawk.exe target/release/squawk-windows-x64.exe
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: release
path: target/release/squawk-windows-x64.exe
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/squawk-windows-x64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-mac:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
include:
- arch: x64
target: x86_64-apple-darwin
- arch: arm64
target: aarch64-apple-darwin
name: macOS ${{ matrix.arch }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
with:
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Build for mac
run: cargo build --release --target=${{ matrix.target }} && mv target/${{ matrix.target }}/release/squawk target/release/squawk-darwin-${{ matrix.arch }}
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: release
path: target/release/squawk-darwin-${{ matrix.arch }}
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/squawk-darwin-${{ matrix.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-linux-x64, build-mac, build-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
lint:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Install Rust Fmt
run: rustup component add rustfmt
- name: Install Clippy
run: rustup component add clippy
- name: Get Clippy Version
run: cargo clippy --version
- name: Lint
run: ./s/lint
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
- name: Cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2
- name: Test
run: ./s/test
check_version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version-file: ".python-version"
- name: Check versions are consistent
run: ./s/check-version