Skip to content

Commit

Permalink
Add auxiliary cache for CI; use more specific date for ZIP bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
polybluez committed Jan 4, 2025
1 parent 8c4c7d0 commit 97506cc
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/build-aux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build auxiliary cache with libraries and assets

on:
workflow_dispatch:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v29
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# To make the environment in the flake's devShell available to future steps:
- uses: rrbutani/use-nix-shell-action@v1
with:
devShell: .#default
- name: Calculate cache hash based on nixpkgs' revision
run: |
NIXPKGS_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."nixpkgs".locked.rev')
echo "NIXPKGS_REV=$NIXPKGS_REV" >> "$GITHUB_ENV"
- name: Build assets
run: |
nix build --inputs-from . --verbose --show-trace --print-build-logs --print-out-paths .#assets.x86_64-linux.defaultAssetsPath
- name: Build libraries for all platforms
run: |
nix build --inputs-from . --verbose --show-trace --print-build-logs --print-out-paths .#forPrebuild.x86_64-linux
- name: Save Nix store
uses: nix-community/cache-nix-action/[email protected]
with:
primary-key: build-aux-${{ runner.os }}-${{ env.NIXPKGS_REV }}
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ jobs:
run: |
NIXPKGS_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."nixpkgs".locked.rev')
echo "NIXPKGS_REV=$NIXPKGS_REV" >> "$GITHUB_ENV"
- uses: nix-community/cache-nix-action/[email protected]
- name: Restore toolchain cache
uses: nix-community/cache-nix-action/[email protected]
with:
primary-key: build-fpc-${{ runner.os }}-${{ env.NIXPKGS_REV }}
fail-on: primary-key.miss
- name: Restore auxiliary cache
uses: nix-community/cache-nix-action/[email protected]
with:
primary-key: build-aux-${{ runner.os }}-${{ env.NIXPKGS_REV }}
fail-on: primary-key.miss
- name: Update Doom2D related inputs and populate environment variables
run: |
bash ./game/bundle/scripts/mkEnv.bash
Expand All @@ -50,6 +56,7 @@ jobs:
D2DF_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }}
RES_LAST_COMMIT_DATE: ${{ env.RES_LAST_COMMIT_DATE }}
EDITOR_LAST_COMMIT_DATE: ${{ env.D2DF_LAST_COMMIT_DATE }}
DISTRO_CONTENT_CREATION_DATE: ${{ env.DISTRO_CONTENT_CREATION_DATE }}
run: |
bash ./game/bundle/scripts/mkZip.bash
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions game/bundle/scripts/mkZip.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ find doom2df-win32 -exec chmod 777 {} \;
find doom2df-win32/executables/ -type f -iname 'doom2df*' -exec touch -d "$D2DF_LAST_COMMIT_DATE" {} \;
find doom2df-win32/executables/ -type f -iname 'editor*' -exec touch -d "$EDITOR_LAST_COMMIT_DATE" {} \;
find doom2df-win32/assets/ -type f -exec touch -d "$RES_LAST_COMMIT_DATE" {} \;
find doom2df-win32/assets/data/lang/ -type f -iname 'editor*.lng' -exec touch -d "$EDITOR_LAST_COMMIT_DATE" {} \;
touch -d "$DISTRO_CONTENT_CREATION_DATE" 'doom2df-win32/assets/Get MORE game content HERE.txt'

if [[ -n "$IS_WINDOWS" ]]; then
find doom2df-win32/executables/ -type f -iname '*.dll' -exec touch -d "$D2DF_LAST_COMMIT_DATE" {} \;
Expand Down

0 comments on commit 97506cc

Please sign in to comment.