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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Deploy to crates.io
on:
push:
tags:
- '*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all
- name: Build release
run: cargo build --release
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_IO }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO }}
- name: Generate documentation
run: cargo doc --no-deps --all-features
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
tag_name: ${{ github.ref_name }}
name: Release v${{ github.ref_name }}
body: |
## What's Changed
See [CHANGELOG.md](CHANGELOG.md) for detailed changes.
## Installation
```bash
cargo install parsm --version ${{ github.ref_name }}
```
Or download the binaries from the assets below.
generate_release_notes: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-binaries:
runs-on: ${{ matrix.os }}
needs: deploy
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact-name: parsm-linux-x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact-name: parsm-windows-x86_64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact-name: parsm-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact-name: parsm-macos-aarch64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary (Unix)
if: matrix.os != 'windows-latest'
run: |
cp target/${{ matrix.target }}/release/parsm ${{ matrix.artifact-name }}
strip ${{ matrix.artifact-name }}
- name: Prepare binary (Windows)
if: matrix.os == 'windows-latest'
run: |
cp target/${{ matrix.target }}/release/parsm.exe ${{ matrix.artifact-name }}
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact-name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}