Skip to content

Commit e91ffeb

Browse files
authored
Merge pull request #1180 from kernelkit/misc
Build, test, and release workflow fixes
2 parents 701dcda + 1125f3b commit e91ffeb

File tree

11 files changed

+248
-90
lines changed

11 files changed

+248
-90
lines changed

.github/CHECKLIST.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ Pull Requests
2727
Releases
2828
--------
2929

30+
Recommended checkpoints, use at your own discretion:
31+
3032
- Make at least one -betaN release to verify the GitHub workflow well in time release day
3133
- Stuff happens, remember kernelkit/infix#735
3234
- Make at least one -rcN to flush out any issues in customer repos
3335
- Easy to forget adaptations/hacks in customer repos -- may need Infix change/support
36+
- Verify release artifacts (checksums, completeness, no corrupted files)
37+
- Test on actual hardware for at least one architecture
38+
- Review ChangeLog for completeness
39+
- Check for release-blocking issues
40+
- Verify generated GNS3 appliance, no marketplace update on -rc builds
3441
- Ensure the markdown link for the release diff is updated
3542
- Ensure subrepos are tagged (can be automated, see kernelkit/infix#393)
3643
- Sync tags for all repo. sync activities
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
use_cache:
10+
required: false
11+
type: boolean
12+
default: true
13+
14+
jobs:
15+
build:
16+
name: Build Infix ${{ inputs.version }} [${{ matrix.target }}]
17+
runs-on: [ self-hosted, release ]
18+
strategy:
19+
matrix:
20+
target: [aarch64, x86_64]
21+
fail-fast: false
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
clean: true
26+
submodules: recursive
27+
28+
- name: Set Release Variables
29+
id: vars
30+
run: |
31+
ver=${{ inputs.version }}
32+
echo "ver=${ver}" >> $GITHUB_OUTPUT
33+
fver=${ver#v}
34+
target=${{ matrix.target }}-${fver}
35+
echo "dir=infix-$target" >> $GITHUB_OUTPUT
36+
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
37+
38+
- name: Restore Cache of dl/
39+
if: ${{ inputs.use_cache }}
40+
uses: actions/cache@v4
41+
with:
42+
path: dl/
43+
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
44+
restore-keys: |
45+
dl-
46+
47+
- name: Restore Cache of .ccache/
48+
if: ${{ inputs.use_cache }}
49+
uses: actions/cache@v4
50+
with:
51+
path: .ccache/
52+
key: ccache-${{ matrix.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
53+
restore-keys: |
54+
ccache-${{ matrix.target }}-
55+
ccache-
56+
57+
- name: Configure & Build
58+
env:
59+
INFIX_RELEASE: ${{ steps.vars.outputs.ver }}
60+
run: |
61+
target=${{ matrix.target }}_defconfig
62+
echo "Building $target ..."
63+
make $target
64+
make
65+
66+
- name: Generate SBOM from Build
67+
run: |
68+
make legal-info
69+
70+
- name: Build test specification
71+
run: |
72+
make test-spec
73+
74+
- name: Prepare Artifacts
75+
run: |
76+
cd output/
77+
mv images ${{ steps.vars.outputs.dir }}
78+
ln -s ${{ steps.vars.outputs.dir }} images
79+
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
80+
81+
mv legal-info legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
82+
tar cfz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}.tar.gz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
83+
84+
- uses: actions/upload-artifact@v4
85+
with:
86+
name: artifact-${{ matrix.target }}
87+
path: output/*.tar.gz
88+
89+
- uses: actions/upload-artifact@v4
90+
with:
91+
name: artifact-disk-image-${{ matrix.target }}
92+
path: output/images/*.qcow2

.github/workflows/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
parallel:
3636
required: false
3737
type: boolean
38-
default: false
38+
default: true
3939

4040
env:
4141
NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
@@ -110,6 +110,11 @@ jobs:
110110
run: |
111111
make ${{ env.TARGET }}_defconfig
112112
113+
- name: Cleanup stale containers and ports
114+
run: |
115+
podman rm -af || true
116+
pkill -9 -f rootlessport || true
117+
113118
- name: Unit Test ${{ env.TARGET }}
114119
run: |
115120
make test-unit

.github/workflows/release.yml

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,87 +18,27 @@ on:
1818
type: string
1919

2020
jobs:
21-
build:
21+
set-version:
2222
if: github.repository == 'kernelkit/infix' && startsWith(github.ref, 'refs/tags/')
23-
name: Build Infix ${{ github.ref_name }} [${{ matrix.target }}]
24-
runs-on: [ self-hosted, release ]
25-
strategy:
26-
matrix:
27-
target: [aarch64, x86_64]
28-
fail-fast: false
23+
runs-on: ubuntu-latest
24+
outputs:
25+
version: ${{ steps.set-ver.outputs.version }}
2926
steps:
30-
- uses: actions/checkout@v4
31-
with:
32-
clean: true
33-
submodules: recursive
34-
35-
- name: Set Release Variables
36-
id: vars
27+
- id: set-ver
3728
run: |
3829
if [ -n "${{ inputs.version }}" ]; then
3930
ver=${{ inputs.version }}
4031
else
4132
ver=${GITHUB_REF#refs/tags/}
4233
fi
43-
echo "ver=${ver}" >> $GITHUB_OUTPUT
44-
fver=${ver#v}
45-
target=${{ matrix.target }}-${fver}
46-
echo "dir=infix-$target" >> $GITHUB_OUTPUT
47-
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
48-
49-
- name: Restore Cache of dl/
50-
uses: actions/cache@v4
51-
with:
52-
path: dl/
53-
key: dl-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
54-
restore-keys: |
55-
dl-
56-
57-
- name: Restore Cache of .ccache/
58-
uses: actions/cache@v4
59-
with:
60-
path: .ccache/
61-
key: ccache-${{ matrix.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
62-
restore-keys: |
63-
ccache-${{ matrix.target }}-
64-
ccache-
65-
66-
- name: Configure & Build
67-
env:
68-
INFIX_RELEASE: ${{ steps.vars.outputs.ver }}
69-
run: |
70-
target=${{ matrix.target }}_defconfig
71-
echo "Building $target ..."
72-
make $target
73-
make
34+
echo "version=${ver}" >> $GITHUB_OUTPUT
7435
75-
- name: Generate SBOM from Build
76-
run: |
77-
make legal-info
78-
79-
- name: Build test specification
80-
run: |
81-
make test-spec
82-
83-
- name: Prepare Artifacts
84-
run: |
85-
cd output/
86-
mv images ${{ steps.vars.outputs.dir }}
87-
ln -s ${{ steps.vars.outputs.dir }} images
88-
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
89-
90-
mv legal-info legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
91-
tar cfz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}.tar.gz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
92-
93-
- uses: actions/upload-artifact@v4
94-
with:
95-
name: artifact-${{ matrix.target }}
96-
path: output/*.tar.gz
97-
98-
- uses: actions/upload-artifact@v4
99-
with:
100-
name: artifact-disk-image-${{ matrix.target }}
101-
path: output/images/*.qcow2
36+
build:
37+
needs: set-version
38+
uses: ./.github/workflows/build-release.yml
39+
with:
40+
version: ${{ needs.set-version.outputs.version }}
41+
use_cache: true
10242

10343
release:
10444
name: Release Infix ${{ github.ref_name }}
@@ -156,6 +96,9 @@ jobs:
15696
run: |
15797
awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \
15898
|head -n -1 > release.md
99+
echo "" >> release.md
100+
echo "> [!TIP]" >> release.md
101+
echo "> **Try Infix in GNS3!** Download the appliance from the [GNS3 Marketplace](https://gns3.com/marketplace/appliances/infix) to test Infix in a virtual network environment without hardware." >> release.md
159102
cat release.md
160103
161104
- uses: ncipollo/release-action@v1

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ jobs:
9090
- name: Publish Test Result for ${{ env.TARGET }}
9191
# Ensure this runs even if Regression Test fails
9292
if: always()
93-
run: cat $TEST_PATH/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
93+
run: |
94+
cat $TEST_PATH/.log/last/result-gh.md >> $GITHUB_STEP_SUMMARY
9495
9596
- name: Generate Test Report for ${{ env.TARGET }}
9697
# Ensure this runs even if Regression Test fails

.github/workflows/trigger.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,61 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
# Gate all builds through this check to prevent wasted runs. Only run on
18+
# 'labeled' events when the label is actually 'ci:main'. Concurrency control
19+
# above handles canceling the 'opened' event when 'labeled' arrives quickly
20+
# after (e.g., when creating a PR with ci:main already attached). See #1154.
21+
check-trigger:
22+
if: |
23+
startsWith(github.repository, 'kernelkit/') &&
24+
(github.event_name != 'pull_request' ||
25+
github.event.action != 'labeled' ||
26+
github.event.label.name == 'ci:main')
27+
runs-on: ubuntu-latest
28+
outputs:
29+
x86_64_target: ${{ steps.set-targets.outputs.x86_64_target }}
30+
aarch64_target: ${{ steps.set-targets.outputs.aarch64_target }}
31+
steps:
32+
- run: |
33+
echo "Triggering build, logging meta data ..."
34+
echo "Event : ${{ github.event_name }}"
35+
echo "Action : ${{ github.event.action }}"
36+
echo "Ref : ${{ github.ref }}"
37+
echo "PR : ${{ github.event.pull_request.number }}"
38+
echo "Label : ${{ github.event.label.name }}"
39+
- id: set-targets
40+
run: |
41+
if [[ "${{ github.event_name }}" == "pull_request" ]] && \
42+
! echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' \
43+
| grep -q "ci:main"; then
44+
echo "x86_64_target=x86_64_minimal" >> $GITHUB_OUTPUT
45+
echo "aarch64_target=aarch64_minimal" >> $GITHUB_OUTPUT
46+
else
47+
echo "x86_64_target=x86_64" >> $GITHUB_OUTPUT
48+
echo "aarch64_target=aarch64" >> $GITHUB_OUTPUT
49+
fi
50+
1751
build-x86_64:
18-
if: startsWith(github.repository, 'kernelkit/')
52+
needs: check-trigger
1953
uses: ./.github/workflows/build.yml
2054
with:
2155
name: "infix"
22-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
56+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
2357

2458
build-aarch64:
25-
if: startsWith(github.repository, 'kernelkit/')
59+
needs: check-trigger
2660
uses: ./.github/workflows/build.yml
2761
with:
2862
name: "infix"
29-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'aarch64_minimal' || 'aarch64' }}
63+
target: ${{ needs.check-trigger.outputs.aarch64_target }}
3064

3165
test-run-x86_64:
32-
if: startsWith(github.repository, 'kernelkit/')
33-
needs: build-x86_64
66+
needs: [check-trigger, build-x86_64]
3467
uses: ./.github/workflows/test.yml
3568
with:
36-
target: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:main') && 'x86_64_minimal' || 'x86_64' }}
69+
target: ${{ needs.check-trigger.outputs.x86_64_target }}
3770
name: "infix"
3871

3972
test-publish-x86_64:
40-
if: startsWith(github.repository, 'kernelkit/')
4173
needs: test-run-x86_64
4274
uses: ./.github/workflows/publish.yml

.github/workflows/weekly.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Weekly release build to catch flaky tests and verify clean builds.
2+
# Runs without caches (ccache) to ensure reproducibility. See issue #1003.
3+
name: Weekly Build
4+
5+
on:
6+
schedule:
7+
- cron: '5 0 * * 6' # Saturday at 00:05 UTC, same as Coverity
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
if: github.repository == 'kernelkit/infix'
13+
uses: ./.github/workflows/build-release.yml
14+
with:
15+
version: "latest"
16+
use_cache: false
17+
18+
publish:
19+
name: Publish Weekly Build
20+
needs: build
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
steps:
25+
- uses: actions/download-artifact@v4
26+
with:
27+
pattern: "artifact-*"
28+
merge-multiple: true
29+
30+
- name: Create checksums
31+
run: |
32+
for file in *.tar.gz; do
33+
sha256sum $file > $file.sha256
34+
done
35+
if ls *.qcow2 &>/dev/null; then
36+
for file in *.qcow2; do
37+
sha256sum "$file" > "$file.sha256"
38+
done
39+
fi
40+
41+
- uses: ncipollo/release-action@v1
42+
with:
43+
tag: latest
44+
name: "Latest Weekly Build"
45+
prerelease: true
46+
makeLatest: false
47+
allowUpdates: true
48+
removeArtifacts: true
49+
body: |
50+
Automated weekly build from `${{ github.sha }}`.
51+
52+
This build runs without caches to catch potential flaky tests and build issues.
53+
Not intended for production use - use official releases instead.
54+
55+
**Commit:** ${{ github.sha }}
56+
**Built:** ${{ github.run_id }}
57+
artifacts: "*.tar.gz*,*.qcow2*"
58+
59+
- name: Summary
60+
run: |
61+
cat <<EOF >> $GITHUB_STEP_SUMMARY
62+
# Weekly Build Published! :package:
63+
64+
Latest artifacts uploaded to:
65+
<https://github.com/kernelkit/infix/releases/tag/latest>
66+
67+
Built from commit: \`${{ github.sha }}\`
68+
EOF

0 commit comments

Comments
 (0)