forked from libgdx/libgdx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move build from workflow job to container action
I've changed the setup of the natives-linux job to not require needing Node 20, so hopefully it will continue to work with newer versions of checkout and upload-artifact for the forseeable future. I've done this by moving the docker setup into its own action (which is local to the repo) that runs a script in the container that builds the natives and snapshots, but doesn't use any third party actions - meaning it should not be need node 20 to be used in the container. Other minor changes: - Used apt-get instead of apt because using apt in a script gives the warning message "apt does not have a stable interface". - Removed usages of sudo just to be consistent (I can't always use sudo because initially sudo isn't installed) - Added --no-daemon to gradle command because only one gradle command is being run so the daemon isn't necessary. - Added --quiet to apt-get usages to cut down unuseful lines in logs - Moved around arguments to apt-get so they're always at the front - removed setup-java and gradle-build-action usages in the natives-linux step because zulu installation is done in the container and gradle is downloaded when the wrapper is run. - gnupg gets installed anyway as a dependency but I added it explicitly because it is needed for dearmoring the azul key Having the action be in a separate actions folder may not be desirable, in which case I can probably move the action into the workflow folder somewhere but I'm not sure where. Copied docker action structure from my similar PR in Jamepad (libgdx/Jamepad#34)
- Loading branch information
Showing
4 changed files
with
61 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Container image that runs your code | ||
FROM ubuntu:18.04 | ||
|
||
# Copies your code file from your action repository to the filesystem path `/` of the container | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Code file to execute when the docker container starts up (`entrypoint.sh`) | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# action.yml | ||
name: 'Build Linux Natives in Docker Container' | ||
description: 'Build Linux Natives in Ubuntu 18.04 docker container' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh -l | ||
|
||
# ubuntu dockerfile is very minimal (only 122 packages are installed) | ||
# need to install updated git (from official git ppa) | ||
apt-get -q update | ||
apt-get -yq install software-properties-common | ||
add-apt-repository ppa:git-core/ppa -y | ||
# install dependencies expected by other steps | ||
apt-get -q update | ||
apt-get -yq install git \ | ||
curl \ | ||
ca-certificates \ | ||
wget \ | ||
bzip2 \ | ||
zip \ | ||
unzip \ | ||
xz-utils \ | ||
sudo gnupg locales | ||
|
||
# set Locale to en_US.UTF-8 (avoids hang during compilation) | ||
locale-gen en_US.UTF-8 | ||
export LANG=en_US.UTF-8 | ||
export LANGUAGE=en_US.UTF-8 | ||
export LC_ALL=en_US.UTF-8 | ||
|
||
# add zulu apt repository - https://docs.azul.com/core/install/debian | ||
curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg | ||
echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list | ||
apt-get -q update | ||
# install zulu JDK and Java build tools | ||
apt-get -yq install zulu17-jdk-headless maven ant | ||
|
||
# Install cross-compilation toolchains | ||
apt-get -yq --force-yes install gcc g++ | ||
apt-get -yq --force-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross | ||
apt-get -yq --force-yes install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross | ||
apt-get -yq --force-yes install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross | ||
|
||
# Build Linux natives | ||
./gradlew jniGen jnigenBuildLinux64 jnigenBuildLinuxARM jnigenBuildLinuxARM64 jnigenBuildLinuxRISCV64 --no-daemon | ||
|
||
# Pack artifacts | ||
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list | ||
zip natives-linux -@ < native-files-list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters