Skip to content

Commit

Permalink
assemble-release tweaks and tests
Browse files Browse the repository at this point in the history
commit b0c35b1
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 21:15:12 2024 -0700

    better name

commit b1dffcc
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 21:10:34 2024 -0700

    sed to the rescue I guess

commit 26935d1
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 21:02:56 2024 -0700

    better tests

commit a72242b
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:59:50 2024 -0700

    ignore top level dir name

commit 38d41db
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:57:13 2024 -0700

    debug info

commit c1ca1de
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:55:18 2024 -0700

    fix unzip call

commit 5ec8bc0
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:52:34 2024 -0700

    correct option name

commit 70fa2c9
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:50:54 2024 -0700

    allow globs to match nothing

commit d2ebbd7
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:46:43 2024 -0700

    oops

commit 7952aee
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:46:04 2024 -0700

    regression test for assemble-release layout

commit 0ea8a66
Author: Andrew Cassidy <[email protected]>
Date:   Thu Sep 12 20:22:28 2024 -0700

    Use working-directory key and include hidden files

    So that zip and upload-artifact produce the same result
  • Loading branch information
drewcassidy committed Sep 13, 2024
1 parent 83c4239 commit d267a7f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/actions/assemble-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runs:
run: |
shopt -s nocaseglob # so globs are case-insensitive
shopt -s globstar
shopt -s nullglob
mkdir -p ${{ env.RELEASE_STAGING }}
cp -r -v ${{ inputs.artifacts }} ${{ env.RELEASE_STAGING }}
cd ${{ env.RELEASE_STAGING }}
Expand All @@ -52,8 +53,8 @@ runs:
- name: Assemble Release
id: assemble-release
shell: bash
working-directory: ${{ env.RELEASE_STAGING }}
run: |
cd ${{ env.RELEASE_STAGING }}
zip -r ${{ github.workspace }}/${{ inputs.output-file-name }}.zip .
echo 'ARTIFACT_FILENAME=${{ inputs.output-file-name }}' >> $GITHUB_ENV
echo 'artifact-path=${{ github.workspace }}/${{ inputs.output-file-name }}' >> $GITHUB_OUTPUT
Expand All @@ -65,3 +66,4 @@ runs:
path: ${{ env.RELEASE_STAGING }}
name: ${{ inputs.output-file-name }}
if-no-files-found: error
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`
2 changes: 1 addition & 1 deletion .github/workflows/internal-test-plugin-nuget.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is an internal test for KSPBuildTools and not intended to be used by other projects
name: Test Plugin Mod
name: Test Plugin Mod (NuGet)

on:
workflow_call:
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/internal-test-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ jobs:
solution-file-path: plugin-mod.csproj

- uses: ./.github/actions/assemble-release
id: assemble-release
with:
artifacts: ${{ env.TESTDIR }}/GameData
working-directory: ${{ env.TESTDIR }}
output-file-name: plugin-mod

- name: Get github artifact
uses: actions/download-artifact@v4
with:
name: plugin-mod
path: github-artifact

- name: Compare with zip artifact
run: |
unzip ${{ steps.assemble-release.outputs.artifact-path }} -d zip-artifact
tree github-artifact
tree zip-artifact
if [[ $(tree github-artifact/* | sed '1d') != $(tree zip-artifact/* | sed '1d') ]]; then echo "tree mismatch" && false; fi # fail if contents differ
if [[ ! -d github-artifact/GameData ]]; then echo "GameData not present" && false; fi # fail if GameData folder isnt present
if [[ -f github-artifact/GameData/plugin-mod/PluginMod.pdb ]]; then echo "pdb still present" && false; fi # fail if PDB is still present

0 comments on commit d267a7f

Please sign in to comment.