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
name: Release
on:
pull_request:
types:
- closed
branches:
- main
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check FMT
run: cargo fmt -- --check
test:
strategy:
matrix:
platform:
- ubuntu-latest
# - windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Run tests
run: cargo test --verbose
# build-artifacts:
# if: github.head_ref == 'release' && github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
# needs:
# - lint
# - test
# strategy:
# fail-fast: false
# matrix:
# include:
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
# - target: x86_64-apple-darwin
# os: macos-latest
# - target: aarch64-apple-darwin
# os: macos-latest
# - target: x86_64-pc-windows-msvc
# os: windows-latest
# env:
# archive_name: artifact
# runs-on: ${{ matrix.os }}
# name: ${{ matrix.target }}
# steps:
# - uses: actions/checkout@v4
# - uses: Swatinem/rust-cache@v2
# - name: Install host target
# run: rustup target add ${{ matrix.target }}
# - name: Install musl-tools
# if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
# run: sudo apt-get install -y musl-tools
# - name: Build
# run: cargo build --release --target ${{ matrix.target }}
# - name: Set archive name (non-Windows)
# id: archive
# run: echo "archive_name=uddf-sdk-${{ matrix.target }}" >> $GITHUB_ENV
# - name: Set archive name (Windows)
# if: ${{ matrix.os == 'windows-latest' }}
# run: echo "archive_name=uddf-sdk-${{ matrix.target }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# - name: Create archive folder
# run: mkdir ${{ env.archive_name }}
# - name: Copy Unix artifact
# if: ${{ matrix.os != 'windows-latest' }}
# run: cp target/${{ matrix.target }}/release ${{ env.archive_name }}
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.target }}
# path: ${{ env.archive_name }}.tgz
# if-no-files-found: error
release:
needs:
- lint
- test
# - build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# with:
# path: artifacts
# merge-multiple: true
- uses: knope-dev/action@v2.1.0
with:
version: 0.13.0
- run: knope release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-crate:
needs:
- release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CRATES_TOKEN }}