love-actions GitHub help

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

love-actions GitHub help

Post by Gunroar:Cannon() »

First off: Sorry, I feel like I'm spamming topics. I'm just trying to get something finished before a certain deadline I have with the limited resources available to me. I'll try to be brief but still explain clearly what I'm asking.

I want to build an android APK, and acquiring a PC and setting up Android Studio 6GB+ seems to be too much for me to do, atleast for the foreseeable future, in my current circumstances.

So I looked around and found out about building projects online, with things like Travis and Google cloud builder.

I'm not sure which one's the best or most reliable, or whether thy even work the way I imagine them to (my highest experience with building projects is compiling apks from libgdx and a java IDE, but that was pretty straight forward), but it says it generates artifacts so it should work? And does it change the icon image/sign, etc? I just need it to be installable on modern phones, not planning to release to play store.

So I know it might be too much to ask someone to just "do an example for me" so I asked AI to help, but we all know how AI is when it comes to writing code and giving programming instructions in general. Semi-accurate but prone to mistakes (for now anyway).

So can someone who knows about builds please look into this and it's possibility:

What I got from AI

Code: Select all

To use Google Cloud Builder to build a Love2D APK, follow these steps:

1. Create a Google Cloud account and enable the Cloud Build API.
2. Install the Google Cloud SDK and configure it with your account credentials.
3. Create a new directory for your Love2D project and navigate to it in the terminal.
4. Initialize a new Git repository and create a `cloudbuild.yaml` file with the following content:
```
steps:
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/love2d-image', '.']
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/love2d-image']
  - name: 'gcr.io/cloud-builders/docker'
    args: ['run', 'gcr.io/$PROJECT_ID/love2d-image', 'love2d', './path/to/your/game.love']
```
Replace `./path/to/your/game.love` with the actual path to your Love2D game file.

1. Create a `Dockerfile` in the same directory with the following content:
```
FROM ubuntu:latest
RUN apt-get update && apt-get install -y love2d
COPY . /app
WORKDIR /app
CMD ["love", "./game.love"]
```
1. Run the command `gcloud builds submit --config cloudbuild.yaml` to trigger the build process.
2. Cloud Build will create a Docker image with Love2D installed and run your game inside the container.
3. Once the build is complete, you can retrieve the built APK from the Cloud Storage bucket specified in the `cloudbuild.yaml` file.

Note: You may need to modify the `cloudbuild.yaml` and `Dockerfile` files to suit your specific requirements. Additionally, ensure you have the necessary dependencies and files in your project directory.@
Google Cloud Builder
Last edited by Gunroar:Cannon() on Sun Sep 22, 2024 2:32 am, edited 1 time in total.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
RNavega
Party member
Posts: 340
Joined: Sun Aug 16, 2020 1:28 pm

Re: How to build projects online (Google Cloud)?

Post by RNavega »

There's Github Actions too. There's a limited version available for free Github accounts (500MB storage limit, 2K minutes per month). I hope the storage limit doesn't include the environment...
What are Google Cloud's limits?

Here are some relevant links:
- https://github.com/love-actions/love-actions-android
- https://github.com/amirisback/automated ... hub-action
- https://burhanrashid52.com/manually-gen ... b-actions/
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: How to build projects online (Google Cloud)?

Post by Gunroar:Cannon() »

RNavega wrote: Fri Sep 13, 2024 12:14 am There's Github Actions too. There's a limited version available for free Github accounts (500MB storage limit, 2K minutes per month). I hope the storage limit doesn't include the environment...
What are Google Cloud's limits?

Here are some relevant links:
- https://github.com/love-actions/love-actions-android
- https://github.com/amirisback/automated ... hub-action
- https://burhanrashid52.com/manually-gen ... b-actions/
Wow! Thanks a looooot :awesome: :cry: I didn't even think GitHub would have anything like that. So this will build an apk artifact as long as it's below 500mb?

(I don't know much about Google Cloud Builder, but it should be linked to a Google cloud account and that should be 15GB free, 100GB on upgrade. There's also a limit of 1000(? I think) builds a month)

(PS: Last link doesn't work, but others are great :) )
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
RNavega
Party member
Posts: 340
Joined: Sun Aug 16, 2020 1:28 pm

Re: How to build projects online (Google Cloud)?

Post by RNavega »

Gunroar:Cannon() wrote: Fri Sep 13, 2024 10:36 am So this will build an apk artifact as long as it's below 500mb?
Yeah, the very last lines of this sample will upload the release .APK build into Github as an artifact (downloadable binary), it's the part that uses "actions/upload-artifact@v3":
https://github.com/love-actions/love-ac ... or-testing

I'm new to this myself but it seems ChatGPT 4o can give hints if you get stuck. If you succeed, do share what you discover eh!
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: How to build projects online (Google Cloud)?

Post by Gunroar:Cannon() »

RNavega wrote: Sat Sep 14, 2024 5:06 am I'm new to this myself but it seems ChatGPT 4o can give hints if you get stuck. If you succeed, do share what you discover eh!
Will do :awesome:
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: love-actions GitHub help

Post by Gunroar:Cannon() »

I pushed through, and learnt about yml structures and github's requirements, but now I'm stuck.

I edited the example in love-actions for android so it won't error and I got this code in my "build.yml":

Code: Select all

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "main" branch
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v4

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.

      - name: Build love android
        id: build-love
        uses: love-actions/love-actions-android@v1
        with:
          app-name: "My Love Game"
          bundle-id: "org.love2d.my_game"
          resource-path: "./assets/android/res"
          icon-specifier: "@mipmap/app"
          love-ref: "0b0ff5551fae8b2079749481cd2b54adbbb25bd"
          love-patch: "./love.patch"
          love-package: "./bird.love"
          libs-path: "./assets/android/libs"
          extra-assets: ./README.md ./license.txt
          product-name: "my-game"
          version-string: "2.3.4"
          version-code: 234
          output-folder: "./dist"
          keystore-alias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
          keystore-base64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
          keystore-key-password: ${{ secrets.ANDROID_KEYSTORE_KEYPASSWORD }}
          keystore-store-password: ${{ secrets.ANDROID_KEYSTORE_STOREPASSWORD }}
But it fails with an error that I don't understand, namely:

Code: Select all

Error: The process '/usr/bin/git' failed with exit code 1
And this one that I'm not sure what it means, an I to create all the files manually for co to work:

Code: Select all

Run cp -r -f ./assets/android/res/* ./love-actions-android/love-android/app/src/main/res/
  cp -r -f ./assets/android/res/* ./love-actions-android/love-android/app/src/main/res/
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Adopt_jdk/11.0.24-8/x64
    JAVA_HOME_11_X64: /opt/hostedtoolcache/Java_Adopt_jdk/11.0.24-8/x64
cp: cannot stat './assets/android/res/*': No such file or directory
Error: Process completed with exit code 1.
What's wrong with my code, anyone? Seems like this is from a wrong commit hash, I fixed but still get errors (especially a lot related to missing directories, shouldn't these be sorted by the yml/love-actions?)

Just incase...
Screenshot_20240922-032923.png
Screenshot_20240922-032923.png (85.19 KiB) Viewed 1096 times
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
RNavega
Party member
Posts: 340
Joined: Sun Aug 16, 2020 1:28 pm

Re: love-actions GitHub help

Post by RNavega »

Edit: Initially I thought that the ./assets/android/res/ was from the SDK, which doesnt make sense that it'd be missing sonce the "ubuntu-latest" environment is supposed to have everything you need to build for Android, as explained by these links: However, now I think that the ./assets/android/res/ stuff is from your game repository, or rather your Android project files. They are your game resource files, so your Github repo would have to have those in there. Someone with experience in building for Android should know more.
Relevant link: https://developer.android.com/guide/top ... ourceTypes
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: love-actions GitHub help

Post by Gunroar:Cannon() »

Okay, I added all the directories and moved on. But now for a while I've been stuck on a java error:

Code: Select all

Run actions/cache@v4
Cache not found for input keys: ndk-21.3.6528147
Run actions/cache@v4
Cache not found for input keys: build-love-11.4
Run cd ./love-actions-android/love-android/

ERROR: JAVA_HOME is set to an invalid directory: /opt/hostedtoolcache/Java_Adopt_jdk/17.0.5-8/x64

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
It mainly says that the java version is 11, but needs 17. When I edit it to get 17 I get an error like above:

Code: Select all

Run actions/cache@v4
Cache not found for input keys: ndk-21.3.6528147
Run actions/cache@v4
Cache not found for input keys: build-love-11.4
Run cd ./love-actions-android/love-android/

ERROR: JAVA_HOME is set to an invalid directory: /opt/hostedtoolcache/Java_Adopt_jdk/17.0.5-8/x64

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
This is what AI says but this insists that the problem is not fixable:
It seems like you're caught in a Java version loop.

Love Actions requires Java 11, but your workflow is setting Java 17. When you switch to Java 11, Love Actions complains about the Java directory.

To break this cycle:

1. Set Java 11 explicitly:
```
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Build love android
id: build-love
uses: love-actions/love-actions-android@v1
with:
# ... (rest of the config remains the same)
```
1. Update the `love-actions-android` version to one that supports Java 17 (if available):
```
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Build love android
id: build-love
uses: love-actions/love-actions-android@v2 # or latest version
with:
# ... (rest of the config remains the same)
```
1. Check the Love Actions documentation for Java version compatibility.

If issues persist, provide more details about the error message or Love Actions configuration.

Additionally, you can try:

- Checking the GitHub Actions runner environment for Java installation locations.
- Setting the `JAVA_HOME` environment variable manually.
- Using a different Java distribution (e.g., `openjdk` instead of `adopt`).
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
RNavega
Party member
Posts: 340
Joined: Sun Aug 16, 2020 1:28 pm

Re: love-actions GitHub help

Post by RNavega »

No idea.

From the second link I posted (the environment for "ubuntu-latest"), it already comes with Java 11 set as the default: https://github.com/actions/runner-image ... me.md#java

The only thing I can think of is changing the failing step of the love-actions code (you didn't say which it is, I'm assuming it's "Build Package (Debug)") to explicitly set it, and seeing if it makes a difference:

Code: Select all

    - name: Build package (Debug)
      env:
        JAVA_HOME: "${JAVA_HOME_11_X64}"
      shell: bash
      run: |
        cd ./love-actions-android/love-android/
        chmod +x ./gradlew
        ./gradlew assembleEmbedRecordDebug
User avatar
Gunroar:Cannon()
Party member
Posts: 1128
Joined: Thu Dec 10, 2020 1:57 am

Re: love-actions GitHub help

Post by Gunroar:Cannon() »

RNavega wrote: Mon Sep 23, 2024 6:03 pm No idea.

From the second link I posted (the environment for "ubuntu-latest"), it already comes with Java 11 set as the default: https://github.com/actions/runner-image ... me.md#java

The only thing I can think of is changing the failing step of the love-actions code (you didn't say which it is, I'm assuming it's "Build Package (Debug)") to explicitly set it, and seeing if it makes a difference:

Code: Select all

    - name: Build package (Debug)
      env:
        JAVA_HOME: "${JAVA_HOME_11_X64}"
      shell: bash
      run: |
        cd ./love-actions-android/love-android/
        chmod +x ./gradlew
        ./gradlew assembleEmbedRecordDebug
Thanks so much, RNaveaga. It still didn't work for me. Thanks for trying to help.

I got a new idea that involves forking the love2D (11.5) android github and then modifying it but I got as far as forking it and just running a normal yml file that was already there.

Please. PLEASE. I know I'm getting annoying at this point but can you guys who know about the building with fit actions help shed light on this, especially slime and
AuahDark wrote: Tue Aug 04, 2020 11:29 am ... YMMV.
slime wrote: Sun Dec 03, 2023 2:33 pm...!

My data connection is horrible and factors aren't very favourable but I need to keep pushing for this project.

How could I modify the files inside the fork to take my game variables? In gradlew?
I should replace the love file like normal?
Or should I go a different route and try android studio on github actions (is that even possible?)
How do I add lua-https to the build?

Please an in-depth answer, a solution, an actual working yml, from you guys and I'll stop my bothering. Please, I'm lost. AI can only go so far.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests