Skip to content

Commit

Permalink
Linux x86_64 Build (#19)
Browse files Browse the repository at this point in the history
Upgrade to LUAROCKS_VERSION=3.11.1, add Linux x86_64 Build and upgrade actions.
  • Loading branch information
humbertodias authored Feb 13, 2025
1 parent cac326e commit 7eaf541
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 45 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,43 @@ jobs:
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
love_version: ['11.5', '11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: nhartland/love-build@dev
id: love-build
with:
app_name: 'hello_world'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/hello_world'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_macos-build
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_win32-build
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_win64-build
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_love-build
path: ${{ steps.love-build.outputs.love-filename }}
# Build the Game of Life test application
- uses: actions/upload-artifact@v4
with:
name: hw_linux_x86_64-build
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}
# Build the Game of Life test application
build-game_of_life:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
love_version: ['11.5', '11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v3
- uses: nhartland/love-build@dev
Expand All @@ -54,19 +58,24 @@ jobs:
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_macos-build
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_win32-build
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_win64-build
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_love-build
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_linux_x86_64-build
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}

34 changes: 22 additions & 12 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,46 @@ jobs:
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
love_version: ['11.5', '11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: nhartland/love-build@master
id: love-build
with:
app_name: 'hello_world'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/hello_world'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_macos-build
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_win32-build
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_win64-build
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: hw_love-build
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_linux_x86_64-build
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}

# Build the Game of Life test application
build-game_of_life:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
love_version: ['11.5', '11.4', '11.3', '11.2', '0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: nhartland/love-build@master
id: love-build
with:
Expand All @@ -54,19 +59,24 @@ jobs:
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_macos-build
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_win32-build
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_win64-build
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: gol_love-build
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_linux_x86_64-build
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}

23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM debian:buster-slim

# Install general dependencies
RUN apt-get update -q -y
RUN apt-get install -q -y lua5.1 \
liblua5.1-0-dev \
build-essential \
libreadline-dev \
wget \
zip
RUN apt update -q -y && \
apt install -q -y lua5.1 liblua5.1-0-dev build-essential libreadline-dev wget zip

# Fetch and build luarocks-3.3.1
RUN wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz && \
tar zxpf luarocks-3.3.1.tar.gz
RUN cd luarocks-3.3.1 && \
# Fetch and build luarocks
ARG LUAROCKS_VERSION=3.11.1
RUN wget https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz && \
tar zxpf luarocks-${LUAROCKS_VERSION}.tar.gz && \
rm luarocks-${LUAROCKS_VERSION}.tar.gz
RUN cd luarocks-${LUAROCKS_VERSION} && \
./configure && \
make && make install

# Copy and setup entrypoint
COPY build.sh /love-build/build.sh
COPY module_loader.lua /love-build/module_loader.lua
ENTRYPOINT ["/love-build/build.sh"]

# docker build . -t love-build --no-cache
# docker run -it -v./tests:/tmp/tests -w /love-build --entrypoint /bin/bash love-build
# INPUT_APP_NAME=hello_word INPUT_LOVE_VERSION=11.5 INPUT_SOURCE_DIR=/tmp/tests/hello_world INPUT_RESULT_DIR=/tmp/result GITHUB_OUTPUT=/tmp/out /love-build/build.sh
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ repository, use the following job steps:

```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Build the applications
- uses: nhartland/love-build@master
with:
app_name: 'hello_world'
love_version: '11.4'
love_version: '11.5'
# Upload the built applications
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: built-applications
path: 'release'
Expand All @@ -42,7 +42,7 @@ steps:
- uses: nhartland/love-build@master
with:
app_name: 'hello_world'
love_version: '11.4'
love_version: '11.5'
# Use when the `main.lua` is in a subdirectory of your repository (here in `src/love`).
source_dir: 'src/love'
# Specifies the output location for the distributables, by default 'release'.
Expand All @@ -69,6 +69,8 @@ the filenames relative to the working directory.
description: 'Filename of built win64 application'
macos-filename:
description: 'Filename of built macos application'
linux_x86_64-filename:
description: 'Filename of built linux application'
```

The applications can therefore be built and individually uploaded with the
Expand All @@ -81,23 +83,27 @@ steps:
id: love-build
with:
app_name: 'hello_world'
love_version: '11.4'
- uses: actions/upload-artifact@v1
love_version: '11.5'
- uses: actions/upload-artifact@v4
with:
name: macos-build
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: win32-build
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: win64-build
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: love-build
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: linux_x86_64-build
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}
```

### LuaRocks dependencies
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
required: true
love_version:
description: 'Version of LÖVE to be used in building the application'
default: '11.3'
default: '11.5'
required: true
dependencies:
description: 'Path to dependencies rockspec relative to GitHub workspace'
Expand All @@ -34,6 +34,8 @@ outputs:
description: 'Path (relative to GitHub workspace) of built win64 application'
macos-filename:
description: 'Path (relative to GitHub workspace) of built macos application'
linux_x86_64-filename:
description: 'Path (relative to GitHub workspace) of built linux application'
runs:
using: 'docker'
image: 'Dockerfile'
28 changes: 28 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ build_windows(){
rm -rf "${bw_build_dir}"
}

build_linux(){
bw_arch=$1
bw_target="${INPUT_APP_NAME}_linux_${bw_arch}"
bw_build_dir=$(mktemp -d -t love-build-XXXXXX)
build_lovefile "${bw_build_dir}/application.love"
(
# Change to build dir (subshell to preserve cwd)
cd "${bw_build_dir}"

# Fetch the appropriate binaries
mkdir -p "${bw_target}"
wget "https://github.com/love2d/love/releases/download/${INPUT_LOVE_VERSION}/love-${INPUT_LOVE_VERSION}-${bw_arch}.AppImage" -O ${bw_target}/love.AppImage

# Copy data
cat "${bw_target}/love.AppImage" "application.love" > "${bw_target}/${INPUT_APP_NAME}-${bw_arch}.AppImage"
rm "${bw_target}/love.AppImage"
chmod +x "${bw_target}/${INPUT_APP_NAME}-${bw_arch}.AppImage"

# Setup final archive
zip -ry "${bw_target}.zip" "${bw_target}"
)
mv "${bw_build_dir}/${bw_target}.zip" "${RESULT_DIR}"/
echo "linux_${bw_arch}-filename=${INPUT_RESULT_DIR}/${bw_target}.zip" >> $GITHUB_OUTPUT
rm -rf "${bw_build_dir}"
}


main() {

echo "-- LOVE build parameters --"
Expand Down Expand Up @@ -155,6 +182,7 @@ main() {
build_macos
build_windows "win32";
build_windows "win64";
build_linux "x86_64";

}

Expand Down

0 comments on commit 7eaf541

Please sign in to comment.