Skip to content

Commit 876ded6

Browse files
committed
ci: add CI/CD pipeline with RPM packaging
- Add Taskfile.yml for build automation - Add Dockerfile for cross-compilation (x86_64/aarch64) - Add semantic-release config (.releaserc.yaml) - Add RPM spec file (pkg/rpm/cosmic-files.spec) - Add GitHub Actions workflows for test and release - Update .gitignore for build artifacts
1 parent b4185d5 commit 876ded6

File tree

10 files changed

+493
-58
lines changed

10 files changed

+493
-58
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "🎉 Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs: {}
6+
7+
concurrency:
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
issues: write
15+
16+
jobs:
17+
release:
18+
name: Build & Release
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Install Task
23+
uses: go-task/setup-task@v1
24+
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
persist-credentials: true
29+
30+
- name: Install semantic-release dependencies
31+
run: |
32+
npm install @semantic-release/exec @semantic-release/git @semantic-release/changelog @semantic-release/github
33+
34+
- name: Run release
35+
run: |
36+
task release
37+
if [ ! -d dist ] || [ -z "$(ls -A dist 2>/dev/null)" ]; then
38+
echo "No release was created - no relevant changes found"
39+
exit 0
40+
fi
41+
export VERSION=$(ls dist | head -n 1 | cut -d'-' -f3)
42+
task repo:update ARCH=x86_64 VERSION=$VERSION
43+
task repo:update ARCH=aarch64 VERSION=$VERSION
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
SSH_KEY: ${{ secrets.BITBUCKET_SSH_KEY }}
47+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
48+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
49+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}

.github/workflows/test.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: "🧪 Test"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Build & Test
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y libclang-dev libglib2.0-dev libxkbcommon-dev
24+
25+
- name: Setup Rust
26+
run: rustup update stable && rustup default stable
27+
28+
- name: Run tests (no default features)
29+
run: cargo test --verbose --no-default-features
30+
31+
- name: Run tests (default features)
32+
run: cargo test --verbose
33+
34+
- name: Run tests (all features)
35+
run: cargo test --verbose --all-features
36+
37+
validate-desktop:
38+
name: Validate .desktop files
39+
runs-on: ubuntu-latest
40+
container:
41+
image: ubuntu:25.10
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Install desktop-file-utils
47+
run: |
48+
apt-get update
49+
apt-get install -y desktop-file-utils findutils
50+
51+
- name: Validate .desktop files
52+
run: |
53+
set -e
54+
echo "Checking for .desktop files..."
55+
files=$(find . -type f -name "*.desktop")
56+
if [ -z "$files" ]; then
57+
echo "No .desktop files found."
58+
exit 0
59+
fi
60+
echo "$files" | while read -r file; do
61+
echo "Validating: $file"
62+
desktop-file-validate "$file"
63+
done

.github/workflows/validate-desktop-files.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/.cargo/
2+
/.cache/
3+
/builder/
24
/debian/*debhelper*
35
/debian/cosmic-files.substvars
46
/debian/cosmic-files/
57
/debian/files
8+
/dist/
69
/flamegraph.svg
710
/heaptrack.*
811
/perf.*

.releaserc.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Semantic Release Configuration
2+
# https://semantic-release.gitbook.io/semantic-release/usage/configuration
3+
4+
branches:
5+
- name: master
6+
7+
plugins:
8+
# Analyze commit messages to determine next version
9+
- "@semantic-release/commit-analyzer"
10+
11+
# Generate release notes
12+
- "@semantic-release/release-notes-generator"
13+
14+
# Generate changelog
15+
- - "@semantic-release/changelog"
16+
- changelogFile: CHANGELOG.md
17+
18+
# Replace version strings and build packages
19+
- - "@semantic-release/exec"
20+
- shell: true
21+
prepareCmd: |
22+
sed -i '0,/^version = "[0-9]\+\.[0-9]\+\.[0-9]\+"$/s//version = "${nextRelease.version}"/' Cargo.toml
23+
sed -i 's/^Version: .*/Version: ${nextRelease.version}/' pkg/rpm/cosmic-files.spec
24+
task docker:run TARGET=dist:all ARCH=x86_64 TARGET_ARCH=x86_64-unknown-linux-gnu
25+
task docker:run TARGET=dist:all ARCH=aarch64 TARGET_ARCH=aarch64-unknown-linux-gnu
26+
27+
# Commit the following changes to git after other plugins have run
28+
- - "@semantic-release/git"
29+
- assets:
30+
- CHANGELOG.md
31+
- Cargo.toml
32+
- Cargo.lock
33+
- pkg/rpm/cosmic-files.spec
34+
35+
# Create a GitHub release with RPM assets
36+
- - "@semantic-release/github"
37+
- assets:
38+
- path: "dist/*x86_64*.rpm"
39+
label: "RPM (x86_64)"
40+
- path: "dist/*aarch64*.rpm"
41+
label: "RPM (aarch64)"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ARG version=1.90
2+
FROM rust:${version}
3+
ARG version
4+
5+
RUN dpkg --add-architecture arm64
6+
RUN apt-get update && apt-get install -y \
7+
cmake \
8+
libclang-dev \
9+
libglib2.0-dev \
10+
libglib2.0-dev:arm64 \
11+
libxkbcommon-dev \
12+
libxkbcommon-dev:arm64 \
13+
pkg-config
14+
15+
RUN apt-get install -y \
16+
g++-aarch64-linux-gnu \
17+
libc6-dev-arm64-cross
18+
19+
# Taskfile support
20+
RUN curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | bash
21+
RUN apt-get install -y task
22+
23+
# RPM support
24+
RUN apt-get install -y rpm librpmbuild10 elfutils
25+
26+
RUN rustup target add --toolchain $version aarch64-unknown-linux-gnu
27+
RUN rustup toolchain install --force-non-host $version-aarch64-unknown-linux-gnu
28+
RUN rustup component add clippy
29+
RUN chmod -R 777 /usr/local/rustup
30+
31+
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
32+
ENV CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
33+
ENV CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
34+
ENV PKG_CONFIG_PATH_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig

0 commit comments

Comments
 (0)