Skip to content

Commit

Permalink
Workflow improvements.
Browse files Browse the repository at this point in the history
Based on the suggestions mentioned by @TSRBerry in #144.

Speeds up compilation time by using ccache + fallbacks to the latest libnx commit if the build process fails with the libnx build available in the devkitPro image.
  • Loading branch information
DarkMatterCore committed Apr 15, 2024
1 parent 2746543 commit bfe301a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
58 changes: 34 additions & 24 deletions .github/workflows/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build nxdumptool-rewrite binary
on:
push:
branches: [ rewrite ]

paths:
- '.github/workflows/rewrite.yml'
- 'code_templates/**'
Expand All @@ -19,62 +20,71 @@ on:
jobs:
build:
runs-on: ubuntu-latest

container:
image: devkitpro/devkita64

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
with:
path: nxdumptool
submodules: recursive
submodules: true

- name: Checkout latest libnx commit
uses: actions/checkout@v4
with:
repository: switchbrew/libnx
path: libnx
submodules: recursive
- name: Set environment variables
run: |
echo "nxdt_commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
- name: Set workspace permissions
run: chmod 777 -R "$GITHUB_WORKSPACE"
- name: Setup ccache
uses: hendrikmuhs/[email protected]

- name: Build and install libnx
working-directory: libnx
# ccache invocation is handled in the build script.
- name: Build nxdumptool-rewrite PoC binary
id: build
continue-on-error: true
run: |
make install -j$(nproc)
./build.sh --noconfirm
- name: Build nxdumptool-rewrite PoC binary
working-directory: nxdumptool
- name: Install latest libnx commit and retry build
id: retry
if: ${{ steps.build.outcome == 'failure' }}
run: |
echo "nxdt_commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
pushd /tmp
git clone https://github.com/switchbrew/libnx
cd libnx
make -j8 PREFIX="ccache aarch64-none-elf-"
make install
popd
./build.sh --noconfirm
#- name: Build nxdumptool-rewrite GUI binary
# working-directory: nxdumptool
# run: |
# make -j$(nproc)
# make -j8 PREFIX="ccache aarch64-none-elf-"

- uses: actions/upload-artifact@v3
with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.nro
path: nxdumptool/code_templates/tmp/nxdt_rw_poc.nro
path: code_templates/tmp/nxdt_rw_poc.nro
if-no-files-found: error

- uses: actions/upload-artifact@v3
with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.elf
path: nxdumptool/code_templates/tmp/nxdt_rw_poc.elf
path: code_templates/tmp/nxdt_rw_poc.elf
if-no-files-found: error

#- uses: actions/upload-artifact@v3
# with:
# name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.nro
# path: nxdumptool/nxdumptool.nro
# path: nxdumptool.nro
# if-no-files-found: error

#- uses: actions/upload-artifact@v3
# with:
# name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.elf
# path: nxdumptool/nxdumptool.elf
# path: nxdumptool.elf
# if-no-files-found: error

- name: Upload artifact to prerelease
Expand All @@ -92,6 +102,6 @@ jobs:
omitBody: True
omitBodyDuringUpdate: True
omitNameDuringUpdate: True
artifacts: "nxdumptool/code_templates/tmp/nxdt_rw_poc.*"
#artifacts: "nxdumptool/code_templates/tmp/nxdt_rw_poc.*, nxdumptool/nxdumptool.*"
artifacts: "code_templates/tmp/nxdt_rw_poc.*"
#artifacts: "code_templates/tmp/nxdt_rw_poc.*, nxdumptool.*"
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ cp $poc_path ./source/main.c

cp ./romfs/icon/nxdumptool.jpg ./romfs/icon/$poc_name.jpg

make BUILD_TYPE="$poc_name" -j$(nproc)
if [ ${ARG,,} != "--noconfirm" ]; then
make BUILD_TYPE="$poc_name" -j$(nproc)
else
make BUILD_TYPE="$poc_name" -j8 PREFIX="ccache aarch64-none-elf-"
fi

rm -f ./romfs/icon/$poc_name.jpg

Expand Down
2 changes: 1 addition & 1 deletion romfs/i18n/en-US/dump_options.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"filename": {
"label": "Filename",
"description": "Filename used for the output dump.\nIllegal filesystem characters will be automatically replaced with underscores (\"_\"). If the inserted SD card is used as the output storage, only ASCII characters will be kept — this is a limitation on Nintendo's FS driver.\nThe file extension cannot be modified, and it is excluded on purpose."
"description": "Filename used for the output dump.\nIllegal filesystem characters will be automatically replaced with underscores (\"_\"). If the inserted SD card is used as the output storage, only ASCII characters will be kept — this is a limitation of Nintendo's FS driver.\nThe file extension cannot be modified, and it is excluded on purpose."
},

"output_storage": {
Expand Down

0 comments on commit bfe301a

Please sign in to comment.