Pcrumley/update actions #1404
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
name: Rust | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- staging | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- "rust/**" | |
- Cargo.toml | |
- Cargo.lock | |
- scripts/ci_prepare_rust.bash | |
- scripts/ci_build_rust.bash | |
- .github/workflows/rust.yaml | |
jobs: | |
lint: | |
name: Format and lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./scripts/ci_prepare_rust.bash | |
shell: bash | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- uses: actions-rs/cargo@v1 | |
name: Format Check | |
with: | |
command: fmt | |
args: -- --check | |
- uses: actions-rs/cargo@v1 | |
name: Lint Check | |
with: | |
command: clippy | |
args: --all-features --all-targets -- -D warnings | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./scripts/ci_prepare_rust.bash | |
shell: bash | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Run tests | |
run: make test-rust | |
build: | |
name: Build binaries | |
needs: [ lint, test ] | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-12 | |
- windows-2022 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./scripts/ci_prepare_rust.bash | |
shell: bash | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Fetch Tags | |
run: git fetch --tags --prune --force | |
- name: Build ${{ matrix.os }} binaries | |
id: build | |
run: ./scripts/ci_build_rust.bash | |
shell: bash | |
- name: Upload Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "*.zip" | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
registry: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [ build ] | |
name: Publish rust release to package-registry | |
runs-on: ubuntu-latest | |
steps: | |
- name: Store tags | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF##refs/tags/}" >> $GITHUB_ENV | |
- name: Hook into package registry | |
uses: swift-nav/swift-cli-publisher@v2 | |
env: | |
DL_LINUX: "sbp_tools-${{ env.VERSION }}-x86_64-unknown-linux-musl.zip" | |
DL_MAC: "sbp_tools-${{ env.VERSION }}-x86_64-apple-darwin.zip" | |
DL_WIN: "sbp_tools-${{ env.VERSION }}-x86_64-pc-windows-msvc.zip" | |
TOOLS: "sbp2json,json2sbp,json2json" | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
gh-name: ${{ secrets.GH_NAME }} | |
gh-email: ${{ secrets.GH_EMAIL }} | |