-
-
Notifications
You must be signed in to change notification settings - Fork 28
110 lines (92 loc) · 2.75 KB
/
ci.yml
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
109
110
name: CI
on:
push:
tags: ["v*"]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build-windows:
name: Windows
runs-on: windows-latest
environment: Windows
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install dependencies
if: runner.os == 'Windows'
run: |
choco install cmake -y
choco install strawberryperl -y
choco install pkgconfiglite -y
choco install llvm -y
choco install nasm -y
shell: cmd
- name: Build
run: |
cargo build --all-features
build-macos:
name: macOS
runs-on: macos-latest
environment: macOS
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew update
brew install --formula cmake pkg-config llvm
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build
run: |
cargo build --all-features
build-linux:
name: Linux
needs: [build-windows, build-macos]
runs-on: ubuntu-latest
environment: Linux
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install depends
run: |
sudo apt update && sudo apt install cmake build-essential clang libclang-dev -y
- name: Build & Tests
run: |
cargo test --all-features
- name: Get tag
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Tag Check
run: |
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV
echo "tag=${{ steps.tag.outputs.tag }}" >> $GITHUB_OUTPUT
if [ -z "${{ steps.tag.outputs.tag }}" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
echo "tag=latest" >> $GITHUB_ENV
fi
- uses: katyo/publish-crates@v2
if: startsWith(github.ref, 'refs/tags/')
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.CR_PAT }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
generate_release_notes: true