Skip to content

Bump version to 0.2.0 #50

Bump version to 0.2.0

Bump version to 0.2.0 #50

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- "docs/**"
- "**.md"
- "LICENSE"
jobs:
# Ensure that the project could be successfully compiled
cargo_check:
name: Check Code Compiles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/cargo@v1
with:
command: check
args: --all
# Run the `rustfmt` code formatter
rustfmt:
name: Rustfmt [Formatter]
needs: cargo_check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# Run the `clippy` linting tool
clippy:
name: Clippy [Linter]
needs: cargo_check
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D clippy::all
cargo_audit:
name: Cargo Audit [Security]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
test:
needs: [cargo_check, rustfmt, clippy]
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable, nightly]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions-rs/cargo@v1
with:
command: test
github_build:
if: startsWith(github.ref, 'refs/tags/v')
name: Build release binaries
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: spacer-x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: spacer-x86_64-unknown-linux-musl.tar.gz
- target: x86_64-apple-darwin
os: macOS-latest
name: spacer-x86_64-apple-darwin.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
name: spacer-x86_64-pc-windows-msvc.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Prepare build artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip spacer.exe
7z a ../../../${{ matrix.name }} spacer.exe
cd -
- name: Prepare build artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip spacer
tar czvf ../../../${{ matrix.name }} spacer
cd -
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
github_release:
if: startsWith(github.ref, 'refs/tags/v')
name: Create GitHub Release
needs: [test, github_build, cargo_audit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download releases from github_build
uses: actions/download-artifact@v3
with:
name: spacer-x86_64-unknown-linux-gnu.tar.gz
path: .
- name: Download releases from github_build
uses: actions/download-artifact@v3
with:
name: spacer-x86_64-unknown-linux-musl.tar.gz
path: .
- name: Download releases from github_build
uses: actions/download-artifact@v3
with:
name: spacer-x86_64-apple-darwin.tar.gz
path: .
- name: Download releases from github_build
uses: actions/download-artifact@v3
with:
name: spacer-x86_64-pc-windows-msvc.zip
path: .
- name: Generate checksums
run: for file in spacer-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Create GitHub release ${{ matrix.target }}
uses: softprops/action-gh-release@v1
with:
files: |
spacer-x86_64-unknown-linux-gnu.tar.gz
spacer-x86_64-unknown-linux-gnu.tar.gz.sha256
spacer-x86_64-unknown-linux-musl.tar.gz
spacer-x86_64-unknown-linux-musl.tar.gz.sha256
spacer-x86_64-apple-darwin.tar.gz
spacer-x86_64-apple-darwin.tar.gz.sha256
spacer-x86_64-pc-windows-msvc.zip
spacer-x86_64-pc-windows-msvc.zip.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cargo_publish:
needs: [test, cargo_audit]
if: startsWith(github.ref, 'refs/tags/v')
name: Publish Cargo Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo login $CRATES_IO_TOKEN
- run: cargo publish
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}