-
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (113 loc) · 3.46 KB
/
build_test_release.yml
File metadata and controls
129 lines (113 loc) · 3.46 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Xodium CI/CD - Build | Test | Release
on:
push:
branches: [ main ]
paths: [ "src/**" ]
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
APP_NAME: illyriaplus
jobs:
build:
name: Build (\${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
environment:
name: "${{ github.ref_name }}"
url: "${{ steps.upload_artifact.outputs.artifact-url }}"
outputs: { VERSION: "${{ steps.get_version.outputs.VERSION }}" }
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v6.0.2
- id: cache_dependencies
name: Cache dependencies
uses: actions/cache@v5.0.4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- id: setup_rust
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3
with:
toolchain: stable
components: rustfmt, clippy
- id: build_artifact
name: Build Artefact
run: cargo build --release --timings
shell: bash
- id: get_version
name: Get Version
run: |
echo "VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_OUTPUT
shell: bash
- id: upload_artifact
name: Upload Artifact
uses: actions/upload-artifact@v7.0.0
with:
name: ${{ env.APP_NAME }}-${{ matrix.os }}
path: target/release/${{ env.APP_NAME }}
retention-days: 7
test:
name: Test (\${{ matrix.os }})
needs: [ build ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
environment:
name: "${{ github.ref_name }}"
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v6.0.2
- id: setup_rust
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3
with:
toolchain: stable
- id: run_tests
name: Run Tests
run: |
cargo test --all --no-fail-fast
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --check
shell: bash
release:
name: Release
needs: [ build, test ]
runs-on: ubuntu-latest
environment:
name: "${{ github.ref_name }}"
url: "${{ steps.create_release.outputs.url }}"
steps:
- id: download_artifact
name: Download Artefact
uses: actions/download-artifact@v8.0.1
with:
name: ${{ env.APP_NAME }}
- id: verify_binary
name: Verify Binary
run: ./${{ env.APP_NAME }} --version
shell: bash
- id: create_release
name: Create Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
draft: ${{ contains(github.event.head_commit.message, '.draft') }}
generate_release_notes: true
prerelease: ${{ contains(github.event.head_commit.message, '.pre') }}
tag_name: v${{ needs.build.outputs.VERSION }}
files: ${{ env.APP_NAME }}-*/${{ env.APP_NAME }}