Skip to content

Prepare 0.6.0 release #114

Prepare 0.6.0 release

Prepare 0.6.0 release #114

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
format:
name: Check code formatting
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable branch
- name: Run cargo fmt
run: cargo fmt --all -- --check
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux
- macos
- windows
include:
- build: linux
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- build: macos
os: macos-latest
target: x86_64-apple-darwin
- build: windows
os: windows-2019
target: i686-pc-windows-msvc
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable branch
- name: Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --locked
- name: Run tests
run: cargo test --release --locked
- name: Prepare binary for upload
if: runner.os != 'windows'
run: |
cp target/release/krapslog krapslog-${{ matrix.target }}
- name: Prepare binary for upload
if: runner.os == 'windows'
run: |
cp target/release/krapslog.exe krapslog-${{ matrix.target }}.exe
- name: Upload Linux and macOS Binaries
if: matrix.build == 'linux' || matrix.build == 'macos'
uses: actions/upload-artifact@v4
with:
name: krapslog-${{ matrix.target }}
path: krapslog-${{ matrix.target }}
- name: Upload Windows Binaries
if: matrix.build == 'windows'
uses: actions/upload-artifact@v4
with:
name: krapslog-${{ matrix.target }}.exe
path: krapslog-${{ matrix.target }}.exe
release:
name: Create draft release
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
path: raw-artifacts
- name: Prepare binary archives
run: |
set -euo pipefail
mkdir staging
mv $(find raw-artifacts -type f | xargs) staging
mkdir archives
cd staging
for target in $(ls); do
if echo "$target" | grep -q ".exe" 2>/dev/null; then
echo "Found Windows binary for target $target"
zip -j ../archives/$target.zip $target
else
echo "Found unix binary for target $target"
tar czf ../archives/$target.tar.gz $target
fi
done
- uses: softprops/action-gh-release@c9b46fe7aad9f02afd89b12450b780f52dacfb2d # ~0.1.15, as of 2023/11/5
with:
token: "${{ secrets.GITHUB_TOKEN }}"
draft: true
prerelease: false
files: |
archives/*