Skip to content

Commit 8270766

Browse files
committed
CI: Replace venv with Toolbx container
This also replace QEMU aarch64 emulation with ARM64 runner
1 parent 92be8f0 commit 8270766

File tree

5 files changed

+80
-71
lines changed

5 files changed

+80
-71
lines changed

.github/actions/build-bst-element/action.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build BuildStream Element
22
inputs:
3-
activate-path:
4-
description: Path to the Python venv (with BuildStream) activate script
3+
shell:
4+
description: Shell with BuildStream env
55
required: true
66
project-options:
77
description: Multiline string with one project option with its value per line (e.g. 'arch x86_64')
@@ -51,10 +51,9 @@ runs:
5151
5252
- name: Build ${{ inputs.element }}
5353
id: build
54-
shell: bash
54+
shell: ${{ inputs.shell }}
5555
run: |
5656
: Build ${{ inputs.element }}
57-
source ${{ inputs.activate-path }}
5857
bst --no-interactive ${{ steps.parse-inputs.outputs.options }} build ${{ inputs.element }}
5958
6059
- name: Upload Logs On Failure
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Ensure Podman
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Check Runner Operating System
6+
if: runner.os != 'Linux'
7+
shell: bash
8+
run: |
9+
: Check Runner Operating System
10+
echo "::notice::setup-buildstream action requires a Ubuntu runner."
11+
exit 2
12+
13+
- name: Ensure Podman
14+
shell: bash
15+
run: |
16+
: Ensure Podman
17+
18+
echo ::group::Install Podman
19+
sudo apt-get install podman
20+
echo ::endgroup::
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Generate BuildStream Artifact
2+
inputs:
3+
shell:
4+
description: Shell with Buildstream env
5+
required: true
6+
element:
7+
description: BuildStream element to generate artifact from
8+
required: true
9+
filename:
10+
description: Artifact filename
11+
required: true
12+
options:
13+
description: Options used in to build the element
14+
default: ''
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Generate BuildStream Artifact
19+
shell: ${{ inputs.shell }}
20+
run: |
21+
: Generate BuildStream Artifact
22+
bst --no-interactive ${{ inputs.options }} artifact checkout ${{ inputs.element }} --tar - | xz -T0 > ${{ inputs.filename }}.tar.xz

.github/actions/setup-buildstream/action.yaml

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Setup BuildStream
22
inputs:
3-
venv-path:
4-
description: Path to the Python venv folder created for BuildStream
5-
required: false
6-
default: ${{ github.workspace }}/.venv
73
caches-path:
84
description: Path to the cache folder that BuildStream will use to cache artifacts
95
required: false
@@ -33,9 +29,9 @@ inputs:
3329
required: false
3430
default: '${GITHUB_REPOSITORY#*/}'
3531
outputs:
36-
activate-path:
37-
description: Path to the Python venv activate script
38-
value: ${{ steps.install-buildstream.outputs.activate-path }}
32+
shell:
33+
description: Shell with BuildStream env
34+
value: ${{ steps.install-buildstream.outputs.shell }}
3935
caches-path:
4036
description: Path to the cache folder that BuildStream uses to cache artifacts
4137
value: ${{ inputs.caches-path }}
@@ -63,11 +59,11 @@ runs:
6359
exit 2
6460
6561
- name: Check Runner Architecture
66-
if: runner.arch != 'x64'
62+
if: runner.arch != 'x64' && runner.arch != 'ARM64'
6763
shell: bash
6864
run: |
6965
: Check Runner Architecture
70-
echo "::notice::setup-buildstream action requires a x86_64 runner."
66+
echo "::notice::setup-buildstream action requires a x86_64 or a ARM64 runner."
7167
exit 2
7268
7369
- name: Check Action Inputs
@@ -101,73 +97,38 @@ runs:
10197
esac
10298
echo ::endgroup::
10399
104-
- name: Install buildbox-integration
105-
env:
106-
DOWNLOAD_URL: https://gitlab.com/api/v4/projects/8347934/packages/generic/releases/1.1.0/buildbox-1.1.0-x86_64-linux-gnu.tgz
107-
DOWNLOAD_SHA256: e2e63112290b5bd6a64ccf26e40a53b73badb7b88dd98b20fca48a8050f93361
100+
- name: Install Toolbx container
108101
shell: bash
109102
run: |
110-
: Install buildbox-integration
103+
: Install Toolbx container
111104
112-
echo ::group::Install dependencies
113-
sudo apt-get install bubblewrap fuse3 arch-test
105+
echo ::group::Install Toolbx
106+
sudo apt-get install podman-toolbox
114107
echo ::endgroup
115108
116-
echo ::group::Create download directory
117-
DOWNLOAD_DIR=$(mktemp -d)
118-
echo ::endgroup::
119-
120-
echo ::group::Download tarball
121-
DOWNLOAD_FILE="${DOWNLOAD_DIR}/$(basename ${DOWNLOAD_URL})"
122-
123-
curl ${DOWNLOAD_URL} --location --output ${DOWNLOAD_FILE}
124-
echo ::endgroup::
125-
126-
echo ::group::Check sha256sum
127-
echo "${DOWNLOAD_SHA256} ${DOWNLOAD_FILE}" | sha256sum --check --status
128-
echo ::endgroup::
129-
130-
echo ::group::Extract to ~/.local/bin
131-
mkdir ~/.local/bin
132-
tar -zxvf ${DOWNLOAD_FILE} -C ~/.local/bin
133-
echo ::endgroup::
134-
135-
echo ::group::Cleanup download directory
136-
rm -rf DOWNLOAD_DIR
137-
echo ::endgroup::
109+
echo ::group::Create container
110+
SHELL=$(which bash) toolbox -y --log-level=info --log-podman create buildstream --distro fedora --release 41
111+
echo ::endgroup
138112
139113
- name: Install BuildStream
140114
id: install-buildstream
141-
env:
142-
ACTIVATE_PATH: ${{ inputs.venv-path }}/bin/activate
143115
shell: bash
144116
run: |
145117
: Install BuildStream
146-
echo ::group::Create and activate Python venv
147-
python -m venv ${{ inputs.venv-path }}
148-
echo "activate-path=${ACTIVATE_PATH}" >> $GITHUB_OUTPUT
149-
source ${ACTIVATE_PATH}
150-
echo ::endgroup::
151118
152119
echo ::group::Install BuildStream
153-
sudo apt-get install lzip
154-
pip install -U BuildStream
155-
echo ::endgroup::
120+
toolbox run -c buildstream sudo dnf -y install buildstream arch-test
121+
echo 'shell=toolbox run -c buildstream bash --noprofile --norc -eo pipefail {0}' >> $GITHUB_OUTPUT
122+
echo ::endgroup
156123
157124
- name: Install BuildStream plugins dependencies
158-
shell: bash
125+
shell: ${{ steps.install-buildstream.outputs.shell }}
159126
run: |
160127
: Install BuildStream plugins dependencies
161-
echo ::group::Activate Python venv
162-
source ${{ steps.install-buildstream.outputs.activate-path }}
163-
echo ::endgroup::
164128
165-
echo ::group::Install plugins dependencies
166-
pip install -U dulwich>=0.21.7 requests packaging tomli
167-
echo ::endgroup::
168-
169-
- name: Set Up QEMU
170-
uses: docker/setup-qemu-action@v3
129+
echo ::group::Install BuildStream plugins dependencies
130+
sudo dnf -y install python3-dulwich python3-requests python3-packaging python3-tomli
131+
echo ::endgroup
171132
172133
- name: Setup BuildStream config file
173134
shell: bash

.github/workflows/build-project.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
jobs:
2121
obs-deps-bst:
2222
name: Pre-build obs-deps.bst
23-
runs-on: ubuntu-24.04
23+
runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
2424
outputs:
2525
cache-key: ${{ steps.cache-restore.outputs.cache-primary-key }}
2626
steps:
@@ -30,6 +30,9 @@ jobs:
3030
- name: Prepare build space
3131
uses: ./.github/actions/prepare-build-space
3232

33+
- name: Ensure Podman
34+
uses: ./.github/actions/ensure-podman
35+
3336
- name: Setup BuildStream
3437
id: setup-buildstream
3538
uses: ./.github/actions/setup-buildstream
@@ -51,7 +54,7 @@ jobs:
5154
if: ${{ (github.ref == 'refs/heads/master') && (steps.cache-restore.outputs.cache-hit != 'true') }}
5255
uses: ./.github/actions/build-bst-element
5356
with:
54-
activate-path: ${{ steps.setup-buildstream.outputs.activate-path }}
57+
shell: ${{ steps.setup-buildstream.outputs.shell }}
5558
project-options: ${{ env.PROJECT_OPTIONS }}
5659
element: obs-deps.bst
5760
logs-path: ${{ steps.setup-buildstream.outputs.logs-path }}
@@ -91,7 +94,7 @@ jobs:
9194
fi
9295
9396
flatpak-modules:
94-
runs-on: ubuntu-24.04
97+
runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
9598
needs: obs-deps-bst
9699
strategy:
97100
matrix:
@@ -107,6 +110,9 @@ jobs:
107110
- name: Prepare build space
108111
uses: ./.github/actions/prepare-build-space
109112

113+
- name: Ensure Podman
114+
uses: ./.github/actions/ensure-podman
115+
110116
- name: Setup BuildStream
111117
id: setup-buildstream
112118
uses: ./.github/actions/setup-buildstream
@@ -126,18 +132,19 @@ jobs:
126132
id: build
127133
uses: ./.github/actions/build-bst-element
128134
with:
129-
activate-path: ${{ steps.setup-buildstream.outputs.activate-path }}
135+
shell: ${{ steps.setup-buildstream.outputs.shell }}
130136
project-options: ${{ env.PROJECT_OPTIONS }}
131137
element: ${{ env.ELEMENT }}
132138
logs-path: ${{ steps.setup-buildstream.outputs.logs-path }}
133139

134140
- name: Prepare ${{ matrix.modules }} Tarball
135141
if: ${{ inputs.upload-artifacts }}
136-
shell: bash
137-
run: |
138-
: Prepare ${{ matrix.modules }} Tarball
139-
source ${{ steps.setup-buildstream.outputs.activate-path }}
140-
bst --no-interactive ${{ steps.build.outputs.options }} artifact checkout ${{ env.ELEMENT }} --tar - | xz -T0 > ${{ env.FILENAME }}.tar.xz
142+
uses: ./.github/actions/generate-bst-artifact
143+
with:
144+
shell: ${{ steps.setup-buildstream.outputs.shell }}
145+
element: ${{ env.ELEMENT }}
146+
filename: ${{ env.FILENAME }}
147+
options: ${{ steps.build.outputs.options }}
141148

142149
- name: Upload ${{ matrix.modules }} Tarball
143150
if: ${{ inputs.upload-artifacts }}

0 commit comments

Comments
 (0)