-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (177 loc) · 6.9 KB
/
ci.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on: [push, pull_request]
jobs:
linux_x86_64:
name: Linux (x86-64)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Install MUSL Toolchain
run: rustup target add x86_64-unknown-linux-musl
- name: Install MUSL dependencies
run: sudo apt-get install musl-tools
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cargo build --release --all --target x86_64-unknown-linux-musl
- name: Execute Tests
run: cargo test --release --all --target x86_64-unknown-linux-musl
- name: Run Clippy
run: cargo clippy --release --all --target x86_64-unknown-linux-musl --all-targets --all-features --locked -- -D warnings
- name: Check Formatting
run: cargo fmt --all -- --check
- uses: actions/upload-artifact@v4
with:
name: linux-x86_64
path: target/x86_64-unknown-linux-musl/release/dmarc-report-viewer
linux_aarch64:
name: Linux (aarch64)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Install Cargo Binary Install
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install Cargo Cross
run: cargo binstall cross --no-confirm
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cross build --release --all --target aarch64-unknown-linux-musl
- name: Execute Tests
run: cross test --release --all --target aarch64-unknown-linux-musl
- uses: actions/upload-artifact@v4
with:
name: linux-aarch64
path: target/aarch64-unknown-linux-musl/release/dmarc-report-viewer
windows_x86_64:
name: Windows (x86-64)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install NASM
uses: ilammy/setup-nasm@v1
- name: Update Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cargo build --release --all
- name: Execute Tests
run: cargo test --release --all
- uses: actions/upload-artifact@v4
with:
name: windows-x86_64
path: target/release/dmarc-report-viewer.exe
mac_x86_64:
name: Mac (x86-64)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Install x64 target
run: rustup target add x86_64-apple-darwin
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cargo build --release --all --target x86_64-apple-darwin
- name: Execute Tests
run: cargo test --release --all --target x86_64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: mac-x86_64
path: target/x86_64-apple-darwin/release/dmarc-report-viewer
mac_aarch64:
name: Mac (aarch64)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cargo build --release --all --target aarch64-apple-darwin
- name: Execute Tests
run: cargo test --release --all --target aarch64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: mac-aarch64
path: target/aarch64-apple-darwin/release/dmarc-report-viewer
docker_linux:
name: Docker (Linux, x86-64, aarch64)
needs: [linux_x86_64, linux_aarch64]
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Prepare Binary Artifacts
run: |
mv linux-x86_64 .github/docker/linux-amd64
mv linux-aarch64 .github/docker/linux-arm64
chmod +x .github/docker/linux-amd64/dmarc-report-viewer
chmod +x .github/docker/linux-arm64/dmarc-report-viewer
- name: Build Docker Images
run: |
cd .github/docker/
docker builder create --name builder
docker buildx build --builder builder --platform=linux/amd64,linux/arm64 --pull .
- name: Build Develop Docker Images
if: ${{github.ref == 'refs/heads/master'}}
run: |
cd .github/docker/
echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker buildx build --builder builder --platform=linux/amd64,linux/arm64 --pull --push --tag ghcr.io/${{github.actor}}/dmarc-report-viewer:develop .
docker run --rm ghcr.io/${{github.actor}}/dmarc-report-viewer:develop ./dmarc-report-viewer --version
- name: Build Release Docker Images
if: startsWith(github.ref, 'refs/tags/')
run: |
cd .github/docker/
echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker buildx build --builder builder --platform=linux/amd64,linux/arm64 --pull --push --tag ghcr.io/${{github.actor}}/dmarc-report-viewer:latest --tag ghcr.io/${{github.actor}}/dmarc-report-viewer:${{github.ref_name}} .
docker run --rm ghcr.io/${{github.actor}}/dmarc-report-viewer:latest ./dmarc-report-viewer --version
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
needs: [linux_x86_64, linux_aarch64, windows_x86_64, mac_x86_64, mac_aarch64, docker_linux]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Pack Artifacts for Release
run: |
zip -r windows-x86_64.zip windows-x86_64
zip -r linux-x86_64.zip linux-x86_64
zip -r linux-aarch64.zip linux-aarch64
zip -r mac-x86_64.zip mac-x86_64
zip -r mac-aarch64.zip mac-aarch64
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
body: Release created automatically from git tag ${{github.ref_name}}, see CHANGELOG.md for more details.
files: |
CHANGELOG.md
LICENSE
windows-x86_64.zip
linux-x86_64.zip
linux-aarch64.zip
mac-x86_64.zip
mac-aarch64.zip