mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-02-04 07:43:18 +00:00
Refactor Android CI workflow to use Nix actions and improve translation file collection
Some checks failed
Android / build (push) Failing after 7m10s
Some checks failed
Android / build (push) Failing after 7m10s
This commit is contained in:
parent
49bc90c00c
commit
2d9aca9000
2 changed files with 103 additions and 19 deletions
87
.github/actions/nix-devshell/action.yml
vendored
Normal file
87
.github/actions/nix-devshell/action.yml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
name: "nix-devshell"
|
||||||
|
description:
|
||||||
|
"Set up Nix, optionally cache, prebuild the devshell and run commands inside
|
||||||
|
the devshell."
|
||||||
|
inputs:
|
||||||
|
prebuild:
|
||||||
|
description:
|
||||||
|
"Whether to prebuild the devshell (nix develop --command true)."
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
commands:
|
||||||
|
description:
|
||||||
|
"Commands to run inside the devshell (executed with bash -lc)."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
cache:
|
||||||
|
description:
|
||||||
|
"Enable caching for Nix artifacts (caches ~/.cache/nix and
|
||||||
|
~/.local/share/nix)."
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
cache-key-files:
|
||||||
|
description: "Files to hash for cache key (glob). Default is 'flake.lock'."
|
||||||
|
required: false
|
||||||
|
default: "flake.lock"
|
||||||
|
cachix-name:
|
||||||
|
description: "Optional Cachix cache name to use (requires cachix token)."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
cachix-token:
|
||||||
|
description: "Optional Cachix token (pass via secrets)."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Install Nix (idempotent)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if ! command -v nix >/dev/null 2>&1; then
|
||||||
|
curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
|
||||||
|
fi
|
||||||
|
# source the nix profile if present
|
||||||
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
fi
|
||||||
|
nix --version
|
||||||
|
|
||||||
|
- name: Setup Cachix (optional)
|
||||||
|
if: ${{ inputs.cachix-name != '' && inputs.cachix-token != '' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
curl -L https://cachix.org/api/install | sh
|
||||||
|
cachix use --token "${{ inputs.cachix-token }}" "${{ inputs.cachix-name }}"
|
||||||
|
|
||||||
|
- name: Cache Nix directories
|
||||||
|
if: ${{ inputs.cache == 'true' }}
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/nix
|
||||||
|
~/.local/share/nix
|
||||||
|
key: ${{ runner.os }}-nix-${{ hashFiles(inputs.cache-key-files) }}
|
||||||
|
restore-keys: ${{ runner.os }}-nix-
|
||||||
|
|
||||||
|
- name: Prebuild devshell
|
||||||
|
if: ${{ inputs.prebuild == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
fi
|
||||||
|
nix --extra-experimental-features 'nix-command flakes' develop --command true
|
||||||
|
|
||||||
|
- name: Run commands in devshell
|
||||||
|
if: ${{ inputs.commands != '' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
fi
|
||||||
|
nix --extra-experimental-features 'nix-command flakes' develop --command bash -lc "${{ inputs.commands }}"
|
||||||
35
.github/workflows/android.yaml
vendored
35
.github/workflows/android.yaml
vendored
|
|
@ -11,28 +11,25 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install Nix (for nix usage)
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
|
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
|
||||||
nix --version
|
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Prepare Nix devshell
|
||||||
|
uses: ./.github/actions/nix-devshell
|
||||||
|
with:
|
||||||
|
prebuild: "true"
|
||||||
|
cache: "true"
|
||||||
|
cache-key-files: "flake.lock"
|
||||||
|
|
||||||
- name: Collect Translation Files
|
- name: Collect Translation Files
|
||||||
run: |
|
uses: ./.github/actions/nix-devshell
|
||||||
set -euo pipefail
|
with:
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
commands: |
|
||||||
nix --version
|
cd lib/l10n
|
||||||
cd lib/l10n
|
python3 collect_translations.py
|
||||||
nix --extra-experimental-features 'nix-command flakes' develop --command python3 collect_translations.py
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Build Debug APK
|
- name: Build Debug APK
|
||||||
run: |
|
uses: ./.github/actions/nix-devshell
|
||||||
set -euo pipefail
|
with:
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
commands: |
|
||||||
nix --version
|
flutter build apk --debug
|
||||||
nix --extra-experimental-features 'nix-command flakes' develop --command flutter build apk --debug
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue