Files
monsoon/.gitea/workflows/ci.yml
rob thijssen 52a9d5e43d
All checks were successful
CI / Format, lint, build, test (push) Successful in 5m59s
CI / Build SRPM (push) Successful in 1m27s
CI / Publish to COPR (push) Successful in 18m55s
ci: add set -ex and ls verification to source tarball step
Debug why dist/index.html isn't in the tarball despite being built
successfully in the previous step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 18:29:27 +03:00

152 lines
4.5 KiB
YAML

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
jobs:
check:
name: Format, lint, build, test
runs-on: fedora
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --check --all
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Build (Rust)
run: cargo build --workspace
- name: Test (Rust)
run: cargo test --workspace
- name: Install frontend deps
run: pnpm install --frozen-lockfile
- name: Build desktop frontend
run: pnpm build
- name: Install web frontend deps
run: cd monsoon-web && pnpm install --frozen-lockfile
- name: Build web frontend
run: cd monsoon-web && pnpm build
- name: Validate desktop file
run: desktop-file-validate data/cafe.lair.monsoon.desktop
- name: Validate AppStream metadata
run: appstreamcli validate --no-net data/cafe.lair.monsoon.metainfo.xml
rpm:
name: Build SRPM
runs-on: fedora
needs: check
steps:
- uses: actions/checkout@v4
- name: Determine version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION=$(sed -n '/\[workspace\.package\]/,/\[/{ s/^version *= *"\(.*\)"/\1/p }' Cargo.toml)
fi
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Building version: ${VERSION}"
- name: Stamp version into all manifests
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Cargo workspace version (single source of truth for Rust crates)
sed -i '/\[workspace\.package\]/,/\[/{ s/^version = ".*"/version = "'"${VERSION}"'"/ }' Cargo.toml
# Tauri
sed -i 's/"version": "[^"]*"/"version": "'"${VERSION}"'"/' src-tauri/tauri.conf.json
# Frontend package.json files
sed -i 's/"version": "[^"]*"/"version": "'"${VERSION}"'"/' package.json
sed -i 's/"version": "[^"]*"/"version": "'"${VERSION}"'"/' monsoon-web/package.json
# RPM spec
sed -i "s/^Version:.*/Version: ${VERSION}/" monsoon.spec
echo "Stamped version ${VERSION} into all manifests"
- name: Pre-build frontends
run: |
set -ex
pnpm install --frozen-lockfile
pnpm build
ls -la dist/
cd monsoon-web
pnpm install --frozen-lockfile
pnpm build
ls -la dist/
cd ..
- name: Generate source tarball
run: |
set -ex
VERSION="${{ steps.version.outputs.VERSION }}"
# Verify dist/ exists before tarring
ls -la dist/index.html
ls -la monsoon-web/dist/index.html
# Include pre-built dist/ and monsoon-web/dist/ so the RPM build
# doesn't need Node.js/pnpm. Write to /tmp to avoid "file changed
# as we read it" from tar writing into the directory it's reading.
tar czf /tmp/monsoon-${VERSION}.tar.gz \
--transform "s,^\.,monsoon-${VERSION}," \
--exclude='./target' \
--exclude='./node_modules' \
--exclude='./monsoon-web/node_modules' \
--exclude='./vendor' \
--exclude='./.git' \
--exclude='*.tar.gz' \
--exclude='*.src.rpm' \
.
mv /tmp/monsoon-${VERSION}.tar.gz .
# Verify frontend assets are in the tarball
tar tzf monsoon-${VERSION}.tar.gz | grep "dist/index.html"
- name: Vendor Rust dependencies
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
cargo vendor vendor/
tar czf monsoon-${VERSION}-vendor.tar.gz vendor/
rm -rf vendor/
- name: Build SRPM
run: |
rpmbuild -bs monsoon.spec \
--define "_sourcedir $(pwd)" \
--define "_srcrpmdir $(pwd)"
- name: Upload SRPM artifact
uses: actions/upload-artifact@v3
with:
name: srpm
path: '*.src.rpm'
copr:
name: Publish to COPR
runs-on: fedora
needs: rpm
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download SRPM
uses: actions/download-artifact@v3
with:
name: srpm
- name: Configure copr-cli
run: |
mkdir -p ~/.config
echo "${{ secrets.COPR_CONFIG }}" > ~/.config/copr
- name: Submit build to COPR
run: copr-cli build monsoon *.src.rpm