Skip to content

Commit

Permalink
Fixing test workflow (#21)
Browse files Browse the repository at this point in the history
Here we merge the dev and master test workflows and separate the older and newer love2d tests.
  • Loading branch information
nhartland authored Feb 13, 2025
1 parent 7eaf541 commit 10fb0b4
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 166 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/dev.yml

This file was deleted.

82 changes: 0 additions & 82 deletions .github/workflows/master.yml

This file was deleted.

153 changes: 153 additions & 0 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Workflow builds two test applications, one with and one without luarocks
name: Testing
on:
pull_request:
branches: [ master ]
push:
branches: [ master, dev ]
jobs:
# Build the Hello World test application
build-hello_world:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.5', '11.4', '11.3', '11.2']
steps:
- uses: actions/checkout@v4
- uses: ./ # User current branch
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@v4
with:
name: hw_macos-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_win32-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_win64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_love-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_linux_x86_64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}

# Build the Hello World test application for older love_versions
# This job leaves out the linux AppImage upload which is not available
build-hello_world-0_x:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v4
- uses: ./ # User current branch
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@v4
with:
name: hw_macos-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_win32-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_win64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v4
with:
name: hw_love-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.love-filename }}

# Build the Game of Life test application
build-game_of_life:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['11.5', '11.4', '11.3', '11.2']
steps:
- uses: actions/checkout@v4
- uses: ./ # Use current branch
id: love-build
with:
app_name: 'game_of_life'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v4
with:
name: gol_macos-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_win32-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_win64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_love-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.love-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_linux_x86_64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.linux_x86_64-filename }}


# Build the Game of Life test application for older love versions
# This job leaves out the linux AppImage upload which is not available
build-game_of_life-0_x:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
love_version: ['0.10.2', '0.9.2', '0.8.0']
steps:
- uses: actions/checkout@v4
- uses: ./ # Use current branch
id: love-build
with:
app_name: 'game_of_life'
love_version: ${{ matrix.love_version }}
source_dir: 'tests/game_of_life'
dependencies: 'tests/game_of_life/dependencies-1-1.rockspec'
# Upload the resulting artifacts
- uses: actions/upload-artifact@v4
with:
name: gol_macos-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.macos-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_win32-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win32-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_win64-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.win64-filename }}
- uses: actions/upload-artifact@v4
with:
name: gol_love-build-${{ matrix.love_version}}
path: ${{ steps.love-build.outputs.love-filename }}

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ provided, the default LÖVE `Info.plist` will be used.

### Basic Configuration

To build and upload a LÖVE 11.4 project with the `main.lua` at the root of your
To build and upload a LÖVE 11.5 project with the `main.lua` at the root of your
repository, use the following job steps:

```yaml
Expand Down Expand Up @@ -69,6 +69,7 @@ the filenames relative to the working directory.
description: 'Filename of built win64 application'
macos-filename:
description: 'Filename of built macos application'
# Only provided for LÖVE >= 11.0
linux_x86_64-filename:
description: 'Filename of built linux application'
```
Expand Down Expand Up @@ -100,6 +101,7 @@ steps:
with:
name: love-build
path: ${{ steps.love-build.outputs.love-filename }}
# Only provided for LÖVE >= 11.0
- uses: actions/upload-artifact@v4
with:
name: linux_x86_64-build
Expand Down Expand Up @@ -152,11 +154,14 @@ are bundled.
### Limitations

This action so far only performs the minimal build required for getting
applications running, for example icons are not yet configurable.
applications running, for example icons are not configurable.

Furthermore the macOS build is unverified by Apple and therefore will need
to be manually opened in the Security and Preferences pane at least for the
first time it is run.

Only projects based on LÖVE version 0.8.0 or greater are supported. Before
0.8.0, no win64 binaries were provided.

For the Linux build, only projects based on LÖVE version 11.0 or greater are
supported. Before 11.0 no AppImages are provided
14 changes: 13 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ if [ "${GITHUB_REPOSITORY}" = "nhartland/love-build" ]; then
set -x
fi

# Function to compare version numbers
version_ge() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}

check_environment() {
: "${INPUT_APP_NAME:?'Error: application name unset'}"
: "${INPUT_LOVE_VERSION:?'Error: love version unset'}"
Expand Down Expand Up @@ -126,6 +131,8 @@ build_windows(){
rm -rf "${bw_build_dir}"
}

# Builds a linux AppImage
# Only available for love2d >= 11.0
build_linux(){
bw_arch=$1
bw_target="${INPUT_APP_NAME}_linux_${bw_arch}"
Expand Down Expand Up @@ -182,7 +189,12 @@ main() {
build_macos
build_windows "win32";
build_windows "win64";
build_linux "x86_64";

if version_ge "${INPUT_LOVE_VERSION}" "11.0"; then
build_linux "x86_64"
else
echo "Skipping Linux build: LOVE version is less than 11.0"
fi

}

Expand Down

0 comments on commit 10fb0b4

Please sign in to comment.