-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (179 loc) · 6.89 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
178
179
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: Enable Rust Caching
uses: Swatinem/rust-cache@v2
- name: Release Build
run: cargo build --release --all
- name: Execute Tests
run: cargo test --release --all
- name: Run Clippy
run: cargo clippy --release --all --all-targets --all-features --locked -- -D warnings
- name: Check Formatting
run: cargo fmt --all -- --check
- uses: actions/upload-artifact@v4
with:
name: x86_64-linux-gnu
path: target/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: aarch64-linux-musl
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: x86_64-windows
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: x86_64-mac
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: aarch64-mac
path: target/aarch64-apple-darwin/release/dmarc-report-viewer
docker_linux_x86_64:
name: Linux Docker (x86-64)
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker Image
run: docker build . --build-arg GITHUB_SHA --build-arg GITHUB_REF_NAME --pull --tag dmarc-report-viewer
- name: Test Docker Image
run: docker run --rm dmarc-report-viewer ./dmarc-report-viewer --help
- name: Publish Latest Docker Image
if: ${{github.ref == 'refs/heads/master'}}
run: |
echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker tag dmarc-report-viewer ghcr.io/${{github.actor}}/dmarc-report-viewer:develop
docker push ghcr.io/${{github.actor}}/dmarc-report-viewer:develop
- name: Publish Tagged Docker Image
if: startsWith(github.ref, 'refs/tags/')
run: |
echo ${{secrets.GITHUB_TOKEN}} | docker login ghcr.io -u ${{github.actor}} --password-stdin
docker tag dmarc-report-viewer ghcr.io/${{github.actor}}/dmarc-report-viewer:latest
docker push ghcr.io/${{github.actor}}/dmarc-report-viewer:latest
docker tag dmarc-report-viewer ghcr.io/${{github.actor}}/dmarc-report-viewer:${{github.ref_name}}
docker push ghcr.io/${{github.actor}}/dmarc-report-viewer:${{github.ref_name}}
- name: Save Docker Image
run: docker save -o dmarc-report-viewer.tar dmarc-report-viewer
- uses: actions/upload-artifact@v4
with:
name: x86_64-linux-docker
path: dmarc-report-viewer.tar
- name: Extract MUSL Binary
run: container_id=$(docker create dmarc-report-viewer) && docker cp "$container_id:/dmarc-report-viewer" ./dmarc-report-viewer && docker rm "$container_id"
- uses: actions/upload-artifact@v4
with:
name: x86_64-linux-musl
path: dmarc-report-viewer
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_x86_64]
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 x86_64-windows.zip x86_64-windows
zip -r x86_64-linux-gnu.zip x86_64-linux-gnu
zip -r x86_64-linux-musl.zip x86_64-linux-musl
zip -r aarch64-linux-musl.zip aarch64-linux-musl
zip -r x86_64-mac.zip x86_64-mac
zip -r aarch64-mac.zip aarch64-mac
mv x86_64-linux-docker/dmarc-report-viewer.tar x86_64-linux-docker.tar
- 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
x86_64-windows.zip
x86_64-linux-gnu.zip
x86_64-linux-musl.zip
aarch64-linux-musl.zip
x86_64-mac.zip
aarch64-mac.zip
x86_64-linux-docker.tar