Skip to content

Commit bcc9af1

Browse files
committed
ci: use shared cit workflow
1 parent f1129c0 commit bcc9af1

2 files changed

Lines changed: 4 additions & 149 deletions

File tree

.daemonless.yml

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

.github/workflows/build.yml

Lines changed: 4 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -8,152 +8,9 @@ on:
88
branches: [main]
99
workflow_dispatch:
1010

11-
env:
12-
REGISTRY: ghcr.io
13-
IMAGE_NAME: sonarr
14-
1511
jobs:
16-
detect:
17-
runs-on: ubuntu-latest
18-
outputs:
19-
matrix: ${{ steps.set-matrix.outputs.matrix }}
20-
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
23-
24-
- name: Detect Containerfiles
25-
id: set-matrix
26-
run: |
27-
entries=""
28-
has_source="false"
29-
30-
if [ -f "Containerfile" ]; then
31-
if grep -q 'io.daemonless.pkg-source="containerfile"' Containerfile; then
32-
has_source="true"
33-
entries+='{"containerfile":"Containerfile","tag":"pkg","base_version":"15-quarterly","version_suffix":"-pkg","push_latest":""},'
34-
entries+='{"containerfile":"Containerfile","tag":"pkg-latest","base_version":"15","version_suffix":"-pkg-latest","push_latest":"--alias latest"},'
35-
else
36-
has_source="true"
37-
entries+='{"containerfile":"Containerfile","tag":"latest","base_version":"","version_suffix":"","push_latest":""},'
38-
fi
39-
fi
40-
41-
if [ -f "Containerfile.pkg" ]; then
42-
entries+='{"containerfile":"Containerfile.pkg","tag":"pkg","base_version":"15-quarterly","version_suffix":"-pkg","push_latest":""},'
43-
if [ "$has_source" = "false" ]; then
44-
entries+='{"containerfile":"Containerfile.pkg","tag":"pkg-latest","base_version":"15","version_suffix":"-pkg-latest","push_latest":"--push-latest"},'
45-
else
46-
entries+='{"containerfile":"Containerfile.pkg","tag":"pkg-latest","base_version":"15","version_suffix":"-pkg-latest","push_latest":""},'
47-
fi
48-
fi
49-
50-
entries="${entries%,}"
51-
matrix="{\"include\":[${entries}]}"
52-
echo "Detected matrix: $matrix"
53-
echo "matrix=$matrix" >> $GITHUB_OUTPUT
54-
5512
build:
56-
needs: detect
57-
if: ${{ needs.detect.outputs.matrix != '{"include":[]}' }}
58-
runs-on: ubuntu-latest
59-
permissions:
60-
contents: read
61-
packages: write
62-
63-
strategy:
64-
fail-fast: false
65-
matrix: ${{ fromJson(needs.detect.outputs.matrix) }}
66-
67-
steps:
68-
- name: Free disk space
69-
uses: jlumbroso/free-disk-space@main
70-
with:
71-
tool-cache: true
72-
android: true
73-
dotnet: true
74-
haskell: true
75-
large-packages: true
76-
docker-images: true
77-
swap-storage: false
78-
79-
- name: Checkout repository
80-
uses: actions/checkout@v4
81-
82-
- name: Prepare VM data directory
83-
run: sudo mkdir -p /mnt/freebsd-vm && sudo chmod 777 /mnt/freebsd-vm
84-
85-
- name: Build and Test in FreeBSD VM (${{ matrix.tag }})
86-
uses: vmactions/freebsd-vm@v1.3.5
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
GITHUB_ACTOR: ${{ github.actor }}
90-
with:
91-
release: "15.0"
92-
usesh: true
93-
copyback: false
94-
data-dir: /mnt/freebsd-vm
95-
envs: "GITHUB_TOKEN GITHUB_ACTOR"
96-
prepare: |
97-
# Create 4GB swap for heavy builds
98-
dd if=/dev/zero of=/swapfile bs=1m count=4096
99-
chmod 0600 /swapfile
100-
mdconfig -a -t vnode -f /swapfile -u 0
101-
swapon /dev/md0
102-
103-
# Build deps
104-
pkg install -y podman
105-
106-
# Test deps (cit)
107-
pkg install -y py311-selenium py311-scikit-image chromium
108-
109-
# Install patched ocijail for .NET apps (mlock support)
110-
fetch -qo /tmp/ocijail.pkg https://github.com/daemonless/freebsd-ports/releases/download/v0.4.0-patched/ocijail-0.4.0_2.pkg
111-
pkg install -fy /tmp/ocijail.pkg
112-
113-
rm -rf /var/db/containers /var/lib/containers 2>/dev/null || true
114-
kldload pf
115-
sysctl net.inet.ip.forwarding=1
116-
sysctl kern.ipc.shm_allow_removed=1
117-
run: |
118-
set -e
119-
120-
# Download shared build script
121-
mkdir -p scripts
122-
fetch -qo scripts/build.sh \
123-
"https://raw.githubusercontent.com/daemonless/daemonless/build-v1.5.0/scripts/build.sh"
124-
chmod +x scripts/build.sh
125-
126-
PUSH_FLAG=""
127-
if [ "${{ github.event_name }}" != "pull_request" ]; then
128-
PUSH_FLAG="--login --push"
129-
fi
130-
131-
BASE_VERSION_ARG=""
132-
if [ -n "${{ matrix.base_version }}" ]; then
133-
BASE_VERSION_ARG="--base-version ${{ matrix.base_version }}"
134-
fi
135-
136-
# Build
137-
./scripts/build.sh \
138-
--registry ${{ env.REGISTRY }} \
139-
--image ${{ env.REGISTRY }}/daemonless/${{ env.IMAGE_NAME }} \
140-
--containerfile ${{ matrix.containerfile }} \
141-
$BASE_VERSION_ARG \
142-
--tag ${{ matrix.tag }} \
143-
--tag-version \
144-
--version-suffix "${{ matrix.version_suffix }}" \
145-
${{ matrix.push_latest }} \
146-
--skip-wip \
147-
$PUSH_FLAG
148-
149-
# Test with cit (only for :latest tag, non-PR)
150-
if [ "${{ matrix.tag }}" = "latest" ] && [ "${{ github.event_name }}" != "pull_request" ]; then
151-
echo "=== Running cit tests ==="
152-
fetch -qo - https://github.com/daemonless/cit/releases/download/v0.1.1/cit-0.1.1.tar.gz | tar xz
153-
154-
./cit-0.1.1/cit ${{ env.REGISTRY }}/daemonless/${{ env.IMAGE_NAME }}:${{ matrix.tag }} \
155-
--repo . \
156-
--screenshot /tmp/${{ env.IMAGE_NAME }}.png \
157-
--verify \
158-
--verbose
159-
fi
13+
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
14+
with:
15+
image_name: sonarr
16+
secrets: inherit

0 commit comments

Comments
 (0)