1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release
# Tag a version to cut a release: git tag v0.10.6 && git push origin v0.10.6
on:
push:
tags:
permissions:
contents: write
jobs:
# Gate: a tag on a commit that can't pass checks must never publish.
check:
name: fmt + clippy + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
continue-on-error: true # matches CI: clippy non-fatal (for now)
- name: Tests
run: cargo test
build:
name: ${{ matrix.target }}
needs: check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: termaxa-linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
name: termaxa-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
name: termaxa-macos-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
name: termaxa-windows-x86_64.exe
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Stage binary (unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/termaxa ${{ matrix.name }}
chmod +x ${{ matrix.name }}
- name: Stage binary (windows)
if: runner.os == 'Windows'
run: cp target/${{ matrix.target }}/release/termaxa.exe ${{ matrix.name }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
if-no-files-found: error
# Runs exactly once: creates the release, attaches all binaries,
# generates notes a single time.
release:
name: publish release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all binaries
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: dist/*
fail_on_unmatched_files: true
generate_release_notes: true