Clean up the build directory if clean is set to true

This commit is contained in:
Nobuyoshi Nakada 2024-03-08 19:34:30 +09:00
parent 22459a8f6d
commit 51f4f1414f
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465
4 changed files with 17 additions and 4 deletions

View file

@ -49,6 +49,13 @@ inputs:
default: '1'
description: The depth of commit history fetched from the remote repository
clean:
required: false
type: boolean
default: ''
description: >-
If set to true, clean build directory.
outputs: {} # nothing?
runs:
@ -147,9 +154,12 @@ runs:
grep -F A.rb a.rb > /dev/null && set "${@:27}"
echo files="$*" >> $GITHUB_OUTPUT
- if: steps.dummy-files.outcome == 'success'
- if: steps.dummy-files.outcome == 'success' || inputs.clean == 'true'
uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
with:
working-directory: ${{ inputs.builddir }}
post:
rm ${{ steps.dummy-files.outputs.files }}
working-directory:
post: |
cd ${{ inputs.builddir }} && rm ${{ steps.dummy-files.outputs.files }}
cd ${{ inputs.builddir }} && make distclean
find ${{ inputs.builddir }} -ls
[ "${{ inputs.builddir }}" = "${{ inputs.srcdir }}" ] || rmdir ${{ inputs.builddir }}

View file

@ -240,6 +240,7 @@ jobs:
srcdir: src
builddir: build
makeup: true
clean: true
- name: Run configure
run: >

View file

@ -67,6 +67,7 @@ jobs:
srcdir: src
builddir: build
makeup: true
clean: true
dummy-files: ${{ matrix.test_task == 'check' }}
# Set fetch-depth: 0 so that Launchable can receive commits information.
fetch-depth: 10

View file

@ -79,6 +79,7 @@ jobs:
srcdir: src
builddir: build
makeup: true
clean: true
dummy-files: ${{ matrix.test_task == 'check' }}
# Set fetch-depth: 10 so that Launchable can receive commits information.
fetch-depth: 10