Skip to content

Commit

Permalink
feat: All inputs from inputs.config
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarreno committed Sep 1, 2023
1 parent 48d527c commit 5b62f57
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/build.lazarus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ on:

workflow_call:
inputs:
app-name:
description: Application Name
required: true
type: string
lpi-path:
description: Path to the *.lpi file
required: true
type: string
triplets:
description: A JSON object containing the triplets
required: true
type: string
config:
description: A JSON object containing configuration values
required: true
Expand Down Expand Up @@ -49,8 +37,8 @@ jobs:
}}
_EXE_TRIPLET_: ${{
matrix.os == 'windows-latest' &&
format('{0}-{1}.exe', inputs.app-name, fromJSON(inputs.config).triplets.(matrix.os)) ||
format('{0}-{1}', inputs.app-name, fromJSON(inputs.config).triplets.(matrix.os))
format('{0}-{1}.exe', fromJSON(inputs.config).app-name, fromJSON(inputs.config).triplets.ubuntu-latest) ||
format('{0}-{1}', fromJSON(inputs.config).app-name, fromJSON(inputs.config).triplets.ubuntu-latest)
}}

strategy:
Expand Down Expand Up @@ -90,7 +78,7 @@ jobs:
run: |
echo App Name: ${{ fromJSON(inputs.config).app-name }}
echo LPI Path: ${{ fromJSON(inputs.config).lpi-path }}/${{ fromJSON(inputs.config).app-name }}.lpi
echo Triplets: ${{ inputs.triplets }}
echo Triplets: ${{ fromJSON(inputs.config).triplets }}
echo Matrix OS: ${{ matrix.os }}
echo Executable: ${{ env._EXE_ }}
echo Executable with triplet: ${{ env._EXE_TRIPLET_ }}
Expand All @@ -102,15 +90,15 @@ jobs:
case "${{ matrix.os }}" in
"windows-latest")
echo Setting win-artefact-path to ${{ fromJSON(inputs.config).triplets[matrix.os] }}
echo "win-artefact-path=${{ fromJSON(inputs.config).triplets[matrix.os] }}" >> "$GIT_OUTPUT"
echo "win-artefact-path=${{ fromJSON(inputs.config).triplets.windows-latest }}" >> "$GIT_OUTPUT"
;;
"ubuntu-latest")
echo Setting lin-artefact-path to ${{ fromJSON(inputs.config).triplets[matrix.os] }}
echo "lin-artefact-path=${{ fromJSON(inputs.config).triplets[matrix.os] }}" >> "$GIT_OUTPUT"
echo "lin-artefact-path=${{ fromJSON(inputs.config).triplets.ubuntu-latest }}" >> "$GIT_OUTPUT"
;;
"macos-latest")
echo Setting osx-artefact-path to ${{ fromJSON(inputs.config).triplets[matrix.os] }}
echo "osx-artefact-path=${{ fromJSON(inputs.config).triplets[matrix.os] }}" >> "$GIT_OUTPUT"
echo "osx-artefact-path=${{ fromJSON(inputs.config).triplets.macos-latest }}" >> "$GIT_OUTPUT"
;;
esac
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/main.lazarus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ jobs:
name: Build Application
uses: gcarreno/re-usable-workflows/.github/workflows/build.lazarus.yml@main
with:
app-name: helloworld
lpi-path: src
triplets: '{
"win": "x86_64-win64",
"lin": "x86_64-linux",
"osx": "x86_64-darwin"
}'
config: '{
"app-name": "helloworld",
"lpi-path": "src",
Expand All @@ -43,8 +36,6 @@ jobs:
name: Test Application
uses: gcarreno/re-usable-workflows/.github/workflows/test.lazarus.yml@main
with:
app-name: helloworldtest
lpi-path: tests
config: '{
"app-name": "helloworld",
"lpi-path": "tests",
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/test.lazarus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ on:

workflow_call:
inputs:
app-name:
description: Application Name
required: true
type: string
lpi-path:
description: Path to the "*.lpi" file
required: true
type: string
config:
description: A JSON object containing configuration values
required: true
Expand Down Expand Up @@ -43,8 +35,8 @@ jobs:
steps:
- name: Print some values
run: |
echo App Name: ${{ inputs.app-name }}
echo LPI Path: ${{ inputs.lpi-path }}/${{ inputs.app-name }}.lpi
echo App Name: ${{ fromJSON(inputs.config).app-name }}
echo LPI Path: ${{ fromJSON(inputs.config).lpi-path }}/${{ fromJSON(inputs.config).app-name }}.lpi
echo Matrix OS: ${{ matrix.os }}
echo Executable: ${{ env._EXE_ }}
echo Config: ${{ inputs.config }}

0 comments on commit 5b62f57

Please sign in to comment.