Skip to content

Commit 3837784

Browse files
committed
DRY, saner, and more importantly: WORKING CI
Signed-off-by: Gregorio Litenstein <[email protected]>
1 parent 4e4cada commit 3837784

File tree

4 files changed

+125
-154
lines changed

4 files changed

+125
-154
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Continuous Builds
1+
name: Run tests
52

63
on:
7-
push:
8-
branches:
9-
- '**'
10-
tags:
11-
- '!**'
4+
workflow_call:
5+
env:
6+
APPIMAGE_BUILDER_REMOTE_REPO_OWNER: ${{ github.repository_owner }}
127

138
jobs:
149
pytest-ubuntu-container:
@@ -18,12 +13,12 @@ jobs:
1813
steps:
1914
- name: Install dependencies
2015
run: |
21-
apt-get -y update
16+
apt-get -y update
2217
apt-get install -y fakeroot python3-pip python3-venv lsb-release binutils patchelf git
2318
- name: Checkout
2419
uses: actions/checkout@v4
2520
with:
26-
fetch-depth: 0'
21+
fetch-depth: 0
2722
- name: Set up a virtualenv
2823
run: |
2924
python3 -m venv .venv
@@ -34,123 +29,107 @@ jobs:
3429
pip install -e .[dev]
3530
pytest tests
3631
37-
pytest-ubuntu-runner:
38-
name: Run tests on Ubuntu 24.04 with python 3.13.
32+
pytest-archlinux:
33+
name: Run tests on ArchLinux (Docker)
3934
runs-on: ubuntu-24.04
35+
container: archlinux
4036
steps:
4137
- name: Install dependencies
42-
run: |
43-
sudo apt-get -y update
44-
sudo apt-get install -y fakeroot lsb-release binutils patchelf git
38+
run: pacman -Syu --noconfirm python-pip binutils patchelf fakeroot lsb-release strace patchelf git
4539
- name: Checkout
4640
uses: actions/checkout@v4
4741
with:
4842
fetch-depth: 0
49-
- name: Clear Python cache
43+
- name: Set up a virtualenv
5044
run: |
51-
sudo rm -rf /__t/Python
52-
- name: Install python
53-
uses: actions/setup-python@v5
54-
with:
55-
python-version: '3.13'
56-
cache: 'pip'
45+
python3 -m venv .venv
5746
- name: Install appimage-builder and run tests
5847
run: |
48+
. .venv/bin/activate
5949
pip install pytest
6050
pip install -e .[dev]
61-
python3 -m pytest tests
51+
pytest tests
6252
63-
pytest-archlinux:
64-
name: Run tests on ArchLinux (Docker)
53+
pytest-ubuntu-runner:
54+
name: Run tests on Ubuntu 24.04 with python 3.13.
6555
runs-on: ubuntu-24.04
66-
container: archlinux
6756
steps:
6857
- name: Install dependencies
69-
run: pacman -Syu --noconfirm python-pip binutils patchelf fakeroot lsb-release strace patchelf git
58+
run: |
59+
sudo apt-get -y update
60+
sudo apt-get install -y fakeroot lsb-release binutils patchelf git
7061
- name: Checkout
7162
uses: actions/checkout@v4
7263
with:
7364
fetch-depth: 0
74-
- name: Set up a virtualenv
65+
- name: Clear Python cache
7566
run: |
76-
python3 -m venv .venv
67+
sudo rm -rf /__t/Python
68+
- name: Install python
69+
uses: actions/setup-python@v5
70+
with:
71+
python-version: '3.13'
72+
cache: 'pip'
7773
- name: Install appimage-builder and run tests
7874
run: |
79-
. .venv/bin/activate
8075
pip install pytest
8176
pip install -e .[dev]
82-
pytest tests
77+
python3 -m pytest tests
8378
84-
build:
79+
build-pack-bash:
8580
runs-on: ubuntu-24.04
8681
needs: [ pytest-ubuntu-container, pytest-ubuntu-runner, pytest-archlinux ]
8782
steps:
8883
- name: Install dependencies
8984
run: |
9085
sudo apt-get update
91-
sudo apt-get install -y patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace git lsb-release
86+
sudo apt-get install -y patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace git lsb-release python3-build python3-setuptools adwaita-icon-theme
9287
sudo wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
9388
sudo chmod +x /usr/local/bin/appimagetool
9489
- name: Checkout
9590
uses: actions/checkout@v4
9691
with:
9792
fetch-depth: 0
93+
- name: Build Python Wheel
94+
run: |
95+
cd ${{ github.workspace }}
96+
python3 -m build
9897
- name: Install appimage-builder
9998
run: |
100-
sudo pip install setuptools twine
101-
pip install --ignore-installed .
99+
pip install --ignore-installed --user --break-system-packages .
102100
- name: Build AppImage
103101
run: |
104-
cd recipes/appimage-builder
105-
export APPIMAGE_BUILDER_VERSION=$(appimage-builder --version | head -1 | cut -f 2 -d" ")
102+
cd ${{ github.workspace }}/recipes/appimage-builder
103+
export APPIMAGE_BUILDER_VERSION=$(appimage-builder --version | head -1 | cut -f 2 -d" ")
104+
echo "APPIMAGE_BUILDER_VERSION=${APPIMAGE_BUILDER_VERSION}" >> $GITHUB_ENV
106105
appimage-builder --skip-test
107-
- name: Upload Artifacts
108-
uses: actions/upload-artifact@v4
109-
with:
110-
name: appimage-builder
111-
path: 'recipes/appimage-builder/appimage-builder*.AppImage*'
112-
test-pack-bash:
113-
runs-on: ubuntu-24.04
114-
needs: build
115-
steps:
116-
- name: Checkout
117-
uses: actions/checkout@v4
118-
with:
119-
fetch-depth: 0
120-
- name: Download AppImage from build job
121-
uses: actions/download-artifact@v4
122-
with:
123-
name: appimage-builder
124-
- name: Install dependencies
125-
run: |
126-
sudo apt install -y adwaita-icon-theme
127106
- name: Pack bash
128107
run: |
129108
# build bash
130109
BUILDER_PATH=$(find $PWD -name appimage-builder-*.AppImage)
131110
chmod +x "$BUILDER_PATH"
132-
cd recipes/bash/
111+
cd ${{ github.workspace }}/recipes/bash/
133112
"$BUILDER_PATH" --skip-test
134113
- name: Test bash
135114
run: |
136-
recipes/bash/*.AppImage --appimage-extract-and-run -c "echo Hello World"
137-
- name: Upload Artifacts
115+
cd ${{ github.workspace }}/recipes/bash/
116+
./bash*.AppImage --appimage-extract-and-run -c "echo Hello World"
117+
- name: Upload AppImageBuilder AppImage
138118
uses: actions/upload-artifact@v4
139119
with:
140-
name: bash
141-
path: 'recipes/bash/*.AppImage*'
142-
publish:
143-
runs-on: ubuntu-24.04
144-
needs: test-pack-bash
145-
if: github.ref == 'refs/heads/main'
146-
steps:
147-
- name: Download AppImage from build job
148-
uses: actions/download-artifact@v4
120+
name: appimage-builder-${{ env.APPIMAGE_BUILDER_VERSION }}.AppImage
121+
path: '${{ github.workspace }}/recipes/appimage-builder/*.AppImage*'
122+
retention-days: 7
123+
- name: Upload AppImageBuilder Python dist
124+
uses: actions/upload-artifact@v4
149125
with:
150-
name: appimage-builder
151-
- uses: "marvinpinto/action-automatic-releases@latest"
126+
name: appimage-builder-${{ env.APPIMAGE_BUILDER_VERSION }}-pydist
127+
path: '${{ github.workspace }}/dist/*'
128+
retention-days: 7
129+
- name: Upload Bash AppImage
130+
uses: actions/upload-artifact@v4
152131
with:
153-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
154-
prerelease: true
155-
automatic_release_tag: Continuous
156-
files: 'appimage-builder*.AppImage*'
132+
name: bash.AppImage
133+
path: '${{ github.workspace }}/recipes/bash/*.AppImage*'
134+
retention-days: 7
135+

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "CI Build"
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build-and-test:
13+
name: "Build and test"
14+
uses: ./.github/workflows/build-test.yml

.github/workflows/pre-release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Pre-release"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: "Run Build and Test Matrix"
12+
uses: ./.github/workflows/build-test.yml
13+
14+
publish:
15+
name: "Publish Pre-release"
16+
runs-on: ubuntu-latest
17+
needs: build
18+
steps:
19+
- name: Download all build artifacts from build job
20+
uses: actions/download-artifact@v4
21+
with:
22+
pattern: "appimage-builder*"
23+
path: "${{ github.workspace }}/release-assets"
24+
merge-multiple: true
25+
- name: Look at downloaded assets
26+
run: |
27+
ls -l "${{ github.workspace }}/"
28+
ls -l "${{ github.workspace }}/release-assets/"
29+
- name: Create 'continuous' Pre-release
30+
uses: softprops/action-gh-release@v2
31+
with:
32+
files: "${{ github.workspace }}/release-assets/*"
33+
tag_name: "continuous"
34+
name: "Continuous Build (Pre-release)"
35+
body: "This is a continuous build which may be unstable."
36+
prerelease: true
Lines changed: 20 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,37 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Release builds
1+
name: "Tagged Release"
52

63
on:
74
push:
85
tags:
9-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
- "v*"
7+
workflow_dispatch:
108

119
jobs:
1210
build:
13-
runs-on: ubuntu-24.04
14-
steps:
15-
- name: Install dependencies
16-
run: |
17-
sudo apt-get install -y patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace git lsb-release
18-
sudo wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
19-
sudo chmod +x /usr/local/bin/appimagetool
20-
- name: Checkout
21-
uses: actions/checkout@v4
22-
with:
23-
fetch-depth: 0
24-
- name: Install appimage-builder
25-
run: |
26-
pip install .
27-
- name: Build AppImage
28-
run: |
29-
cd recipes/appimage-builder
30-
export APPIMAGE_BUILDER_VERSION=$(appimage-builder --version | head -1 | cut -f 2 -d" ")
31-
appimage-builder --skip-test
32-
- name: Upload Artifacts
33-
uses: actions/upload-artifact@v4
34-
with:
35-
name: appimage-builder
36-
path: 'recipes/appimage-builder/appimage-builder*.AppImage*'
37-
test:
38-
runs-on: ubuntu-24.04
11+
name: "Run Build and Test Matrix"
12+
uses: ./.github/workflows/build-test.yml
13+
14+
publish:
15+
name: "Publish Tagged Release"
16+
runs-on: ubuntu-latest
3917
needs: build
4018
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v4
43-
with:
44-
fetch-depth: 0
45-
- name: Download AppImage from build job
19+
- name: Download all build artifacts from build job
4620
uses: actions/download-artifact@v4
4721
with:
48-
name: appimage-builder
49-
- name: Install dependencies
50-
run: |
51-
sudo apt install -y adwaita-icon-theme
52-
- name: Pack bash
53-
run: |
54-
# build bash
55-
BUILDER_PATH=$(find $PWD -name appimage-builder-*.AppImage)
56-
chmod +x "$BUILDER_PATH"
57-
cd recipes/bash/
58-
"$BUILDER_PATH" --skip-test
59-
- name: Test bash
60-
run: |
61-
recipes/bash/*.AppImage --appimage-extract-and-run -c "echo Hello World"
62-
- name: Upload Artifacts
63-
uses: actions/upload-artifact@v4
64-
with:
65-
name: bash
66-
path: 'recipes/bash/*.AppImage*'
67-
publish-appimage:
68-
runs-on: ubuntu-24.04
69-
needs: test
70-
steps:
71-
- name: Download AppImage from build job
72-
uses: actions/download-artifact@v4
73-
with:
74-
name: appimage-builder
75-
- uses: "marvinpinto/action-automatic-releases@latest"
22+
pattern: "appimage-builder*-pydist"
23+
path: release-assets
24+
merge-multiple: true
25+
26+
- name: Create GitHub Release
27+
uses: softprops/action-gh-release@v2
7628
with:
77-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
29+
files: release-assets/*
7830
prerelease: false
79-
files: 'appimage-builder*.AppImage*'
80-
publish-python-wheel:
81-
runs-on: ubuntu-24.04
82-
needs: test
83-
steps:
84-
- uses: actions/checkout@v4
85-
- name: Install dependencies
86-
run: |
87-
sudo pip install --upgrade pip
88-
sudo pip install setuptools twine
89-
- name: Build and publish
31+
- name: Publish wheel
9032
env:
9133
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
9234
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
9335
run: |
94-
python3 -m build
95-
twine upload dist/*
36+
sudo apt-get -y install python3-twine
37+
twine upload release-assets/*

0 commit comments

Comments
 (0)