Skip to content

Fix "Generate artifacts" stage in CI #1580

Fix "Generate artifacts" stage in CI

Fix "Generate artifacts" stage in CI #1580

Workflow file for this run

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@v5
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- name: Install rust stable latest
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt,clippy
- name: Format Check
run: cargo fmt -- --check
- name: Lint Check
run : cargo clippy --all-features --all-targets -- -D warnings
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: make test-rust
build:
name: Build binaries
needs: [lint, test]
strategy:
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-musl
- os: macos-13
target: x86_64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.31.2"
- run: ./scripts/ci_prepare_rust.bash
shell: bash
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- 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/[email protected]
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@v3
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 }}