Skip to content

Commit c6e4b77

Browse files
authored
convert action into container (#10)
1 parent 0715f21 commit c6e4b77

File tree

5 files changed

+175
-99
lines changed

5 files changed

+175
-99
lines changed

.github/workflows/docker.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
- linux/amd64
2828
- linux/arm64
2929
- linux/arm/v7
30-
- linux/ppc64le
31-
- linux/s390x
30+
3231
fail-fast: true
3332
steps:
3433
-

.github/workflows/test.yml

Lines changed: 82 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,97 +17,108 @@ on:
1717
- '**test.yml'
1818

1919
env:
20-
VERSION: action-test
20+
VERSION: container-test
2121

2222
jobs:
2323
test-rmw:
2424
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
27-
platform: ['amd64', 'arm64', 'arm/v7']
27+
platform:
28+
- linux/amd64
29+
- linux/arm64
30+
- linux/arm/v7
31+
2832
steps:
29-
- name: Checkout
33+
- name: Checkout rmw
3034
uses: actions/checkout@v4
31-
- name: Use action from self
32-
uses: ./
3335
with:
34-
platform: ${{ matrix.platform }}
35-
dependency_commands: |
36-
export -p
37-
sudo apt install -y libncursesw5-dev
38-
build_commands: |
39-
git clone --depth 1 https://github.com/theimpossibleastronaut/rmw
40-
cd rmw
41-
meson setup _build -Dprefix=/usr
42-
cd _build
43-
ninja
44-
install_to_appdir_commands: |
45-
meson install --destdir=$APPDIR --skip-subprojects
46-
linuxdeploy_output_version: $VERSION
47-
linuxdeploy_args: |
48-
-d rmw/packaging/rmw.desktop \
49-
--icon-file=rmw/packaging/rmw_icon_32x32.png \
50-
--icon-filename=rmw \
51-
--executable=$APPDIR/usr/bin/rmw \
52-
-o appimage
36+
repository: theimpossibleastronaut/rmw
5337

54-
- name: Create sha256sum
55-
run: |
56-
cd out
57-
sha256sum $IMAGE_FILENAME > $IMAGE_FILENAME.sha256sum
38+
- if: ${{ ! contains(matrix.platform, 'amd64') }}
39+
uses: docker/setup-qemu-action@v3
5840

59-
- name: Upload AppImage
60-
uses: actions/upload-artifact@v4
61-
with:
62-
name: ${{ env.IMAGE_FILENAME }}
63-
path: ./out/*
64-
if-no-files-found: error
41+
- name: Set variables
42+
run: |
43+
if [ -z "$VERSION" ]; then
44+
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
45+
fi
6546
66-
test-netpanzer:
67-
runs-on: ubuntu-latest
68-
strategy:
69-
matrix:
70-
platform: [amd64]
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v4
74-
- name: Use action from self
75-
uses: ./
76-
with:
77-
platform: ${{ matrix.platform }}
78-
dependency_commands: |
79-
sudo apt install -y \
80-
gettext \
81-
liblua5.1-0-dev \
82-
libphysfs-dev \
83-
libsdl2-dev \
84-
libsdl2-mixer-dev \
85-
libsdl2-ttf-dev
86-
build_commands: |
87-
git clone --depth 1 https://github.com/netpanzer/netpanzer
88-
cd netpanzer
89-
meson setup _build -Dprefix=/usr
90-
cd _build
91-
ninja
92-
install_to_appdir_commands: |
93-
meson install --destdir=$APPDIR --skip-subprojects
94-
linuxdeploy_output_version: $VERSION
95-
linuxdeploy_args: |
96-
-d netpanzer/support/win32/netpanzer.desktop \
97-
--custom-apprun=netpanzer/support/appimage/AppRun \
98-
--icon-file=netpanzer/netpanzer.png \
99-
--icon-filename=netpanzer \
100-
--executable $APPDIR/usr/bin/netpanzer \
101-
--output appimage
47+
- name: Build AppImage
48+
run: |
49+
docker run -t \
50+
--rm \
51+
--platform=${{ matrix.platform }} \
52+
-e HOSTUID=$(id -u) \
53+
-e VERSION \
54+
-v $GITHUB_WORKSPACE:/workspace \
55+
-w /workspace \
56+
andy5995/linuxdeploy:latest packaging/appimage/pre-appimage.sh
10257
10358
- name: Create sha256sum
10459
run: |
60+
IMAGE_FILENAME=$(basename `find out/*AppImage`)
61+
echo "IMAGE_FILENAME=$IMAGE_FILENAME" >> $GITHUB_ENV
10562
cd out
106-
sha256sum $IMAGE_FILENAME > $IMAGE_FILENAME.sha256sum
63+
sha256sum "$IMAGE_FILENAME" > "$IMAGE_FILENAME.sha256sum"
10764
10865
- name: Upload AppImage
10966
uses: actions/upload-artifact@v4
11067
with:
11168
name: ${{ env.IMAGE_FILENAME }}
11269
path: ./out/*
11370
if-no-files-found: error
71+
72+
#test-netpanzer:
73+
#runs-on: ubuntu-latest
74+
#strategy:
75+
#matrix:
76+
#platform: [amd64]
77+
#steps:
78+
#- name: Checkout
79+
#uses: actions/checkout@v4
80+
#- name: Checkout netpanzer
81+
#uses: actions/checkout@v4
82+
#with:
83+
#repository: netpanzer/netpanzer
84+
#path: netpanzer
85+
#- name: Use action from self
86+
#uses: ./
87+
#with:
88+
#platform: ${{ matrix.platform }}
89+
#pre_appimage_script: rmw/packaging/appimage/pre
90+
#sudo apt install -y \
91+
#gettext \
92+
#liblua5.1-0-dev \
93+
#libphysfs-dev \
94+
#libsdl2-dev \
95+
#libsdl2-mixer-dev \
96+
#libsdl2-ttf-dev
97+
#build_commands: |
98+
#git clone --depth 1 https://github.com/netpanzer/netpanzer
99+
#cd netpanzer
100+
#meson setup _build -Dprefix=/usr
101+
#cd _build
102+
#ninja
103+
#install_to_appdir_commands: |
104+
#meson install --destdir=$APPDIR --skip-subprojects
105+
#linuxdeploy_output_version: $VERSION
106+
#linuxdeploy_args: |
107+
#-d netpanzer/support/win32/netpanzer.desktop \
108+
#--custom-apprun=netpanzer/support/appimage/AppRun \
109+
#--icon-file=netpanzer/netpanzer.png \
110+
#--icon-filename=netpanzer \
111+
#--executable $APPDIR/usr/bin/netpanzer \
112+
#--output appimage
113+
114+
#- name: Create sha256sum
115+
#run: |
116+
#cd out
117+
#sha256sum $IMAGE_FILENAME > $IMAGE_FILENAME.sha256sum
118+
119+
#- name: Upload AppImage
120+
#uses: actions/upload-artifact@v4
121+
#with:
122+
#name: ${{ env.IMAGE_FILENAME }}
123+
#path: ./out/*
124+
#if-no-files-found: error

.github/workflows/versioning.yml

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

ChangeLog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2024-02-12
2+
3+
* Convert Action to a container
4+
* Release v2.0.0
5+
6+
2024-02-08
7+
8+
* Release v1.1.1
9+
* Add arm/v7 support
10+
* Install more recent versions of CMake, Meson, and Ninja

README.md

Lines changed: 82 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,89 @@
1-
# linuxdeploy Build Helper
1+
# linuxdeploy Build Helper Container
22

33
A docker container that aims to help build an
4-
[AppImage](https://github.com/AppImage/AppImageKit) using
5-
[linuxdeploy](https://github.com/linuxdeploy/linuxdeploy).
4+
[AppImage](https://github.com/AppImage/AppImageKit) on multiple architectures
5+
using [linuxdeploy](https://github.com/linuxdeploy/linuxdeploy).
66

7-
## Note:
7+
## Available architectures
88

9-
Formerly this was an action. After much trial-and-error, I've decided to focus
10-
on making an image that can be run locally or in a GitHub runner by project
11-
managers using a script. Examples will be provided.
9+
amd64
10+
arm64
11+
arm/v7
1212

13-
<!--
14-
## Contributing
13+
(The appimage plugin doesn't yet support 'ppc64le' or 's390x')
14+
15+
## Example usage
16+
17+
docker run -t \
18+
--rm \
19+
-e HOSTUID=$(id -u) \
20+
-e VERSION=test \
21+
-v $PWD:/workspace \
22+
-w /workspace \
23+
andy5995/linuxdeploy:latest packaging/appimage/pre-appimage.sh
24+
25+
This is meant to be run from the source root of your project. Using the
26+
command above, your current directory will be mounted in the container at
27+
`/workspace`.
28+
29+
When the container starts, 'root' changes the UID of user 'builder' (a user
30+
created during the build of the Dockerfile) to HOSTUID. This allows builder to
31+
build your project and create the AppImage without root privileges (the
32+
resulting files will be owned by you).
33+
34+
The only argument given after the name of the docker image in the `docker run`
35+
command is the path/name of the script that builds your projects and includes
36+
the command to call linuxdeploy. You can see an example at
37+
[rmw/packaging/appimage/pre-appimage.sh](https://github.com/theimpossibleastronaut/rmw/blob/master/packaging/appimage/pre-appimage.sh).
38+
39+
You may use `sudo` in your script to install packages or do other things.
40+
41+
If you would like to look around the container, you can use
42+
43+
docker run -it --rm --entrypoint sh andy5995/linuxdeploy:latest
44+
45+
## Locally
46+
47+
If you want to clean your project build directory, add `-e CLEAN_BUILD=true`
48+
to the `docker run` arguments.
49+
50+
To build for other architectures, you may need to use qemu with docker. There
51+
may be other ways, but you can check out [this
52+
document](https://www.stereolabs.com/docs/docker/building-arm-container-on-x86)
53+
for starters. If you are set up to build on other architectures, add
54+
`--platform=linux/<arch>` to the `docker run` arguments.
1555

16-
Open an issue and ask about a change before starting work on a pull
17-
request. -->
56+
## In a GitHub Runner
57+
58+
See [tests.yml](https://github.com/andy5995/linuxdeploy-build-helper-container/blob/trunk/.github/workflows/test.yml)
59+
60+
## linuxdeploy Plugins
61+
62+
These plugins are installed in the container:
63+
64+
* [linuxdeploy-plugin-gtk](https://github.com/linuxdeploy/linuxdeploy-plugin-gtk)
65+
* [linuxdeploy-plugin-qt](https://github.com/linuxdeploy/linuxdeploy-plugin-qt)
66+
67+
## Note
68+
69+
The container runs Ubuntu 20.04 (Focal Fossil). See [this
70+
discussion](https://github.com/orgs/AppImage/discussions/1254) for more
71+
details on why I chose that version of Ubuntu.
72+
73+
Some 'GITHUB_...' variables will not work inside the container.
74+
75+
Recent version of cmake, meson, and ninja are installed to
76+
'/home/builder/.local/bin' which is the first path in PATH (installing them
77+
with `apt` will probably offer no benefit).
78+
79+
If you want to see more details about the container or what packages are
80+
pre-installed, look at the two Dockerfiles in this repository. If you'd like
81+
more packages pre-installed, please open an issue.
82+
83+
## Contributing
1884

85+
Ok, but it's a good idea to open an issue and ask about a change before
86+
starting work on a pull request. Someone, or myself, may already be working on
87+
it, or planning to. Also, please consult [this
88+
guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/best-practices-for-pull-requests)
89+
before you submit a pull request.

0 commit comments

Comments
 (0)