refactor: Putting fail-fast
ans an input param
#3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lazarus Test Workflow | ||
defaults: | ||
run: | ||
shell: bash | ||
on: | ||
workflow_call: | ||
inputs: | ||
config: | ||
description: A JSON object containing configuration values | ||
required: true | ||
type: string | ||
fail-fast: | ||
description: Fail Fast on the jobs | ||
required: true | ||
type: bool | ||
jobs: | ||
strategy: | ||
fail-fast: ${{ fromJSON(inputs.config).fail-fast }} | ||
test-app: | ||
name: test [${{ matrix.os }}] [${{ matrix.lazarus-versions }}] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
_EXE_: ${{ | ||
matrix.os == 'windows-latest' && | ||
format('{0}.exe', fromJSON(inputs.config).app-name) || | ||
fromJSON(inputs.config).app-name | ||
}} | ||
strategy: | ||
matrix: ${{ fromJSON(inputs.config).matrix }} | ||
steps: | ||
- name: Build env from inputs.config | ||
run: | | ||
( | ||
echo "app-name=${{ fromJSON(inputs.config).app-name }}" | ||
echo "lpi-path=${{ fromJSON(inputs.config).lpi-path }}" | ||
echo "bin-path=${{ fromJSON(inputs.config).bin-path }}" | ||
echo "build-mode=${{ fromJSON(inputs.config).build-mode }}" | ||
echo "lazarus-packages=${{ fromJSON(inputs.config).lazarus-packages }}" | ||
echo "what-suite=${{ fromJSON(inputs.config).what-suite }}" | ||
echo "output-format=${{ fromJSON(inputs.config).output-format }}" | ||
) >> "$GITHUB_ENV" | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
submodules: true | ||
- name: Install Lazarus | ||
uses: gcarreno/setup-lazarus@v3 | ||
with: | ||
lazarus-version: ${{ matrix.lazarus-versions }} | ||
include-packages: "${{ env.lazarus-packages }}" | ||
with-cache: false | ||
- name: Build the Main App | ||
run: lazbuild -B --bm="${{ env.build-mode }}" "${{ env.lpi-path }}/${{ env.app-name }}.lpi" | ||
- name: Run the tests | ||
run: | | ||
if [ "${{ env.what-suite }}" == "all" ];then | ||
${{ env.bin-path }}/${{ env._EXE_ }} --all --format="${{ env.output-format }}" | ||
else | ||
${{ env.bin-path }}/${{ env._EXE_ }} --suite="${{ env.what-suite }}" --format="${{ env.output-format }}" | ||
fi | ||
# - name: Print some values | ||
# run: | | ||
# echo Config: ${{ inputs.config }} | ||
# echo App Name: ${{ env.app-name }} | ||
# echo LPI Path: ${{ env.lpi-path }}/${{ env.app-name }}.lpi | ||
# echo BIN Path: ${{ env.bin-path }}/${{ env._EXE_ }} | ||
# echo What tests: ${{ env.what-tests }} | ||
# echo Output format: ${{ env.output-format }} | ||
# echo Matrix OS: ${{ matrix.os }} | ||
# echo Executable: ${{ env._EXE_ }} |