Skip to content

Commit 73747d6

Browse files
committed
Update CI Pipelines and use modular approach
A lot of DRY and don't use deprecated actions, outdated versions. Signed-off-by: Gregorio Litenstein <g.litenstein@gmail.com>
1 parent c2b7757 commit 73747d6

File tree

4 files changed

+86
-120
lines changed

4 files changed

+86
-120
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is a reusable workflow. It is NOT triggered directly by Git events.
2+
# It is called by other workflows to perform the build and test steps.
3+
name: "Build and run tests"
4+
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false # Ensure all matrix jobs run, even if one fails
13+
matrix:
14+
TARGET_ARCH: [ i386, x86_64, gnueabihf, aarch64 ]
15+
BUILD_TYPE: [ Debug, Release ]
16+
env:
17+
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
18+
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
19+
20+
steps:
21+
- name: Checkout repository code
22+
uses: actions/checkout@v4
23+
24+
- name: Build ${{ matrix.BUILD_TYPE }} for ${{ matrix.TARGET_ARCH }}
25+
run: ./tooling/build-in-docker.sh ${{ matrix.BUILD_TYPE }}
26+
27+
- name: Test ${{ matrix.BUILD_TYPE }} for ${{ matrix.TARGET_ARCH }}
28+
if: ${{ matrix.TARGET_ARCH == 'x86_64' || matrix.TARGET_ARCH == 'i386' }}
29+
run: ./tooling/test-in-docker.sh ${{ matrix.BUILD_TYPE }}
30+
31+
- name: Rename artifacts
32+
run: |
33+
cd "cmake-build-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}/src/"
34+
sudo mv "apprun/AppRun" "apprun/AppRun-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}"
35+
sudo mv "hooks/libapprun_hooks.so" "hooks/libapprun_hooks-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}.so"
36+
37+
- name: Upload AppRun artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: "AppRun-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}"
41+
path: "cmake-build-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}/src/apprun/AppRun-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}"
42+
retention-days: 7
43+
44+
- name: Upload libapprun_hooks artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: "libapprun_hooks-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}.so"
48+
path: "cmake-build-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}/src/hooks/libapprun_hooks-${{ matrix.BUILD_TYPE }}-${{ matrix.TARGET_ARCH }}.so"
49+
retention-days: 7

.github/workflows/ci.yml

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,14 @@
1-
name: "build"
1+
name: "CI Build"
22

33
on:
4-
push:
5-
branches-ignore:
6-
- master
7-
tags-ignore:
8-
- 'v*'
4+
pull_request:
5+
workflow_dispatch:
96

10-
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
TARGET_ARCH: [ i386, x86_64, gnueabihf, aarch64 ]
16-
BUILD_TYPE: [ Debug, Release ]
17-
env:
18-
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
19-
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
24-
- name: Build ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
25-
run: tooling/build-in-docker.sh ${{ env.BUILD_TYPE }}
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
2610

27-
- name: Test ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
28-
if: ${{ env.TARGET_ARCH == 'x86_64' || env.TARGET_ARCH == 'i386' }}
29-
run: tooling/test-in-docker.sh ${{ env.BUILD_TYPE }}
30-
31-
- name: Prepare artifacts
32-
shell: bash
33-
working-directory: cmake-build-${{ env.BUILD_TYPE }}-${{ env.TARGET_ARCH }}
34-
run: |
35-
mkdir -p ${{runner.workspace}}/dist
36-
cp src/apprun/AppRun ${{runner.workspace}}/dist/AppRun-$BUILD_TYPE-$TARGET_ARCH
37-
cp src/hooks/libapprun_hooks.so ${{runner.workspace}}/dist/libapprun_hooks-$BUILD_TYPE-$TARGET_ARCH.so
38-
39-
- name: Upload Artifacts ${{ env.TARGET_ARCH }}
40-
uses: actions/upload-artifact@v4
41-
with:
42-
name: artifacts
43-
path: ${{runner.workspace}}/dist/*
11+
jobs:
12+
build-and-test:
13+
name: "Build and test"
14+
uses: ./.github/workflows/build.yml

.github/workflows/pre-release.yml

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,33 @@
1-
name: "pre-release"
1+
name: "Pre-release"
22

33
on:
44
push:
55
branches:
66
- "master"
7+
workflow_dispatch:
78

89
jobs:
910
build:
10-
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
TARGET_ARCH: [ i386, x86_64, gnueabihf, aarch64 ]
14-
BUILD_TYPE: [ Debug, Release ]
15-
env:
16-
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
17-
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
18-
19-
steps:
20-
- uses: actions/checkout@v4
21-
22-
- name: Build ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
23-
run: tooling/build-in-docker.sh ${{ env.BUILD_TYPE }}
24-
25-
- name: Test ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
26-
if: ${{ env.TARGET_ARCH == 'x86_64' || env.TARGET_ARCH == 'i386' }}
27-
run: tooling/test-in-docker.sh ${{ env.BUILD_TYPE }}
28-
29-
- name: Prepare artifacts
30-
shell: bash
31-
working-directory: cmake-build-${{ env.BUILD_TYPE }}-${{ env.TARGET_ARCH }}
32-
run: |
33-
mkdir -p ${{runner.workspace}}/dist
34-
cp src/apprun/AppRun ${{runner.workspace}}/dist/AppRun-$BUILD_TYPE-$TARGET_ARCH
35-
cp src/hooks/libapprun_hooks.so ${{runner.workspace}}/dist/libapprun_hooks-$BUILD_TYPE-$TARGET_ARCH.so
36-
37-
- name: Upload Artifacts ${{ env.TARGET_ARCH }}
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: artifacts
41-
path: ${{runner.workspace}}/dist/*
11+
name: "Run Build and Test Matrix"
12+
uses: ./.github/workflows/build.yml
4213

4314
publish:
15+
name: "Publish Pre-release"
4416
runs-on: ubuntu-latest
4517
needs: build
4618
steps:
47-
- name: Download artifacts from build job
19+
- name: Download all build artifacts from build job
4820
uses: actions/download-artifact@v4
4921
with:
50-
name: artifacts
51-
52-
- name: Release In-Development AppImage
53-
uses: marvinpinto/action-automatic-releases@latest
22+
pattern: "*"
23+
path: release-assets
24+
merge-multiple: true
5425

26+
- name: Create 'continuous' Pre-release
27+
uses: softprops/action-gh-release@v2
5528
with:
56-
title: Continuous build
57-
automatic_release_tag: 'continuous'
29+
files: release-assets/*
30+
tag_name: "continuous"
31+
name: "Continuous Build (Pre-release)"
32+
body: "This is a continuous build which may be unstable."
5833
prerelease: true
59-
draft: false
60-
files: ./*
61-
repo_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,30 @@
1-
name: "tagged-release"
1+
name: "Tagged Release"
22

33
on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
78

89
jobs:
910
build:
10-
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
TARGET_ARCH: [ i386, x86_64, gnueabihf, aarch64 ]
14-
BUILD_TYPE: [ Debug, Release ]
15-
env:
16-
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
17-
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
18-
19-
steps:
20-
- uses: actions/checkout@4
21-
22-
- name: Build ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
23-
run: tooling/build-in-docker.sh ${{ env.BUILD_TYPE }}
24-
25-
- name: Test ${{ matrix.BUILD_TYPE }} ${{ matrix.TARGET_ARCH }}
26-
if: ${{ env.TARGET_ARCH == 'x86_64' || env.TARGET_ARCH == 'i386' }}
27-
run: tooling/test-in-docker.sh ${{ env.BUILD_TYPE }}
28-
29-
- name: Prepare artifacts
30-
shell: bash
31-
working-directory: cmake-build-${{ env.BUILD_TYPE }}-${{ env.TARGET_ARCH }}
32-
run: |
33-
mkdir -p ${{runner.workspace}}/dist
34-
cp src/apprun/AppRun ${{runner.workspace}}/dist/AppRun-$BUILD_TYPE-$TARGET_ARCH
35-
cp src/hooks/libapprun_hooks.so ${{runner.workspace}}/dist/libapprun_hooks-$BUILD_TYPE-$TARGET_ARCH.so
36-
37-
- name: Upload Artifacts ${{ env.TARGET_ARCH }}
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: artifacts
41-
path: ${{runner.workspace}}/dist/*
11+
name: "Run Build and Test Matrix"
12+
uses: ./.github/workflows/build.yml
4213

4314
publish:
15+
name: "Publish Tagged Release"
4416
runs-on: ubuntu-latest
4517
needs: build
4618
steps:
47-
- name: Download artifacts from build job
19+
- name: Download all build artifacts from build job
4820
uses: actions/download-artifact@v4
4921
with:
50-
name: artifacts
22+
pattern: "*"
23+
path: release-assets
24+
merge-multiple: true
5125

52-
- uses: "marvinpinto/action-automatic-releases@latest"
26+
- name: Create GitHub Release
27+
uses: softprops/action-gh-release@v2
5328
with:
54-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
29+
files: release-assets/*
5530
prerelease: false
56-
files: ./*

0 commit comments

Comments
 (0)