Skip to content

Commit d2c2a1f

Browse files
committed
copy shit from other shit here so we can idk
1 parent 7ad9338 commit d2c2a1f

4 files changed

Lines changed: 1290 additions & 0 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
name: Rust CI and Docker Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build:
17+
strategy:
18+
matrix:
19+
include:
20+
- runner: ubuntu-latest
21+
arch: x86_64
22+
- runner: ubuntu-24.04-arm
23+
arch: aarch64
24+
runs-on: ${{ matrix.runner }}
25+
permissions:
26+
contents: read
27+
packages: write
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Install system dependencies (Linux)
33+
if: runner.os == 'Linux'
34+
run: |
35+
if command -v apt-get &> /dev/null; then
36+
sudo apt-get update
37+
sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev
38+
elif command -v yum &> /dev/null; then
39+
sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel
40+
elif command -v dnf &> /dev/null; then
41+
sudo dnf install -y pkgconfig openssl-devel
42+
elif command -v pacman &> /dev/null; then
43+
sudo pacman -Sy --noconfirm pkgconf openssl
44+
elif command -v apk &> /dev/null; then
45+
sudo apk add --no-cache pkgconfig openssl-dev
46+
else
47+
echo "Package manager not found. Please install pkg-config and openssl-dev manually."
48+
exit 1
49+
fi
50+
51+
- name: Install Rust
52+
uses: dtolnay/rust-toolchain@stable
53+
with:
54+
toolchain: "1.92"
55+
components: rustfmt, clippy
56+
57+
- name: Setup Rust cache
58+
uses: Swatinem/rust-cache@v2
59+
60+
- name: Build
61+
run: cargo build --verbose
62+
63+
- name: Run tests
64+
run: cargo test --verbose
65+
66+
- name: Check formatting
67+
run: cargo fmt -- --check
68+
69+
- name: Run clippy
70+
run: cargo clippy -- -D warnings
71+
72+
- name: Check
73+
run: cargo check
74+
75+
- name: Build release artifact
76+
run: cargo build --release --verbose
77+
78+
- name: Strip binary
79+
run: strip target/release/devendra
80+
81+
- name: Install cargo-deb
82+
run: cargo install cargo-deb
83+
84+
- name: Build test Debian package
85+
run: cargo deb --no-build --no-strip
86+
87+
- name: Upload test artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: devendra-test-${{ matrix.arch }}-linux
91+
path: target/release/devendra
92+
93+
- name: Upload test Debian package
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: devendra-test-${{ matrix.arch }}-linux.deb
97+
path: target/debian/*.deb
98+
99+
100+
release:
101+
name: Release
102+
if: startsWith(github.ref, 'refs/tags/v')
103+
needs: build
104+
permissions:
105+
contents: write
106+
packages: write
107+
strategy:
108+
matrix:
109+
include:
110+
- os: ubuntu-latest
111+
name: devendra-x86_64-linux-gnu.tar.gz
112+
archive_cmd: tar -czf
113+
binary_ext: ""
114+
rust: "1.92"
115+
- os: ubuntu-24.04-arm
116+
name: devendra-aarch64-linux-gnu.tar.gz
117+
archive_cmd: tar -czf
118+
binary_ext: ""
119+
rust: "1.92"
120+
- os: macos-latest
121+
name: devendra-aarch64-macos.tar.gz
122+
archive_cmd: tar -czf
123+
binary_ext: ""
124+
rust: "1.92"
125+
- os: windows-latest
126+
name: devendra-x86_64-windows.zip
127+
archive_cmd: 7z a
128+
binary_ext: ".exe"
129+
rust: "1.92"
130+
runs-on: ${{ matrix.os }}
131+
132+
steps:
133+
- uses: actions/checkout@v4
134+
135+
- name: Install system dependencies (self-hosted Linux)
136+
if: runner.os == 'Linux'
137+
run: |
138+
if command -v apt-get &> /dev/null; then
139+
sudo apt-get update
140+
sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libgdk-pixbuf2.0-dev libpango1.0-dev libglib2.0-dev
141+
elif command -v yum &> /dev/null; then
142+
sudo yum install -y pkgconfig openssl-devel gtk3-devel gdk-pixbuf-devel pango-devel
143+
elif command -v dnf &> /dev/null; then
144+
sudo dnf install -y pkgconfig openssl-devel
145+
elif command -v pacman &> /dev/null; then
146+
sudo pacman -Sy --noconfirm pkgconf openssl
147+
elif command -v apk &> /dev/null; then
148+
sudo apk add --no-cache pkgconfig openssl-dev
149+
else
150+
echo "Package manager not found. Please install pkg-config and openssl-dev manually."
151+
exit 1
152+
fi
153+
154+
- name: Install Rust
155+
uses: dtolnay/rust-toolchain@stable
156+
with:
157+
toolchain: ${{ matrix.rust }}
158+
159+
- name: Setup Rust cache
160+
uses: Swatinem/rust-cache@v2
161+
with:
162+
key: ${{ matrix.os }}-${{ matrix.rust }}
163+
164+
- name: Build release binary
165+
run: cargo build --release --verbose
166+
167+
- name: Strip binary (Unix)
168+
if: matrix.os != 'windows-latest'
169+
run: |
170+
strip target/release/devendra${{ matrix.binary_ext }}
171+
172+
- name: Create release archive (Unix)
173+
if: matrix.os != 'windows-latest'
174+
run: |
175+
cd target/release
176+
tar -czf ../../${{ matrix.name }} devendra
177+
cd ../..
178+
179+
- name: Create release archive (Windows)
180+
if: matrix.os == 'windows-latest'
181+
run: |
182+
cd target/release
183+
7z a ../../${{ matrix.name }} devendra.exe
184+
cd ../..
185+
186+
- name: Install cargo-deb (Linux)
187+
if: runner.os == 'Linux'
188+
run: cargo install cargo-deb
189+
190+
- name: Build Debian package (Linux)
191+
if: runner.os == 'Linux'
192+
run: cargo deb --no-build --no-strip
193+
194+
- name: Upload release archive
195+
uses: actions/upload-artifact@v4
196+
with:
197+
name: ${{ matrix.name }}
198+
path: ${{ matrix.name }}
199+
200+
- name: Upload Debian package
201+
if: runner.os == 'Linux'
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: devendra-${{ matrix.os }}.deb
205+
path: target/debian/*.deb
206+
207+
create-release:
208+
name: Create Release
209+
runs-on: ubuntu-latest
210+
if: startsWith(github.ref, 'refs/tags/v')
211+
needs: release
212+
permissions:
213+
contents: write
214+
steps:
215+
- uses: actions/checkout@v4
216+
217+
- name: Download all artifacts
218+
uses: actions/download-artifact@v4
219+
with:
220+
path: artifacts
221+
222+
- name: Create release notes
223+
run: |
224+
echo "# devendra Release ${GITHUB_REF_NAME}" > release_notes.md
225+
echo "" >> release_notes.md
226+
echo "## Changes in this release" >> release_notes.md
227+
echo "" >> release_notes.md
228+
echo "## Supported Platforms" >> release_notes.md
229+
echo "" >> release_notes.md
230+
echo "- Linux (x86_64)" >> release_notes.md
231+
echo "- Linux (aarch64)" >> release_notes.md
232+
echo "- Windows (x86_64)" >> release_notes.md
233+
echo "- macOS (x86_64 and Apple Silicon)" >> release_notes.md
234+
echo "" >> release_notes.md
235+
echo "## Installation" >> release_notes.md
236+
echo "" >> release_notes.md
237+
echo "1. Download the appropriate archive for your platform" >> release_notes.md
238+
echo "2. Extract the binaries" >> release_notes.md
239+
echo "3. Place them in your PATH" >> release_notes.md
240+
echo "" >> release_notes.md
241+
242+
- name: Create GitHub Release
243+
uses: softprops/action-gh-release@v1
244+
with:
245+
files: |
246+
artifacts/*/*.tar.gz
247+
artifacts/*/*.zip
248+
artifacts/*/*.deb
249+
body_path: release_notes.md
250+
draft: false
251+
prerelease: ${{ contains(github.ref_name, '-') }}
252+
generate_release_notes: true
253+
env:
254+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)