diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ece7615 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Build + +on: + workflow_call: + inputs: + build-type: + description: 'build type' + type: string + required: true +defaults: + run: + shell: bash -euxo pipefail {0} + + +jobs: + + build: + strategy: + matrix: + state: [ lfc, nolfc ] + runs-on: "ubuntu-latest" + steps: + - name: uses-lfc + id: uselfc + run: echo value=${{ matrix.state == 'lfc' && true || false }} >> $GITHUB_OUTPUT + - name: echolfc + run: | + echo ${{ steps.uselfc.outputs.value }} + echo ${{inputs.build-type}} + - name: say + continue-on-error: ${{ matrix.state == 'lfc' && contains(inputs.build-type, 'debug')}} + run: echo ${{ matrix.state }}; [ ${{ matrix.state }} != "lfc" ] diff --git a/.github/workflows/cet.yml b/.github/workflows/cet.yml index 3b18b77..0044d30 100644 --- a/.github/workflows/cet.yml +++ b/.github/workflows/cet.yml @@ -19,6 +19,7 @@ jobs: run: exit 0 - name: step2 + if: false if: ${{inputs.run_s2}} run: exit 1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 166662c..3fbacfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,15 +4,22 @@ defaults: run: shell: bash -euxo pipefail {0} jobs: - generate-a-secret-output: + build: + strategy: + matrix: + build-type: [release,debug] + uses: ./.github/workflows/build.yml + with: + build-type: ${{matrix.build-type}} + + conclusion: + if: always() + needs: [build] runs-on: ubuntu-latest steps: - - id: sets-a-secret - name: Generate, mask, and output a secret - run: | - the_secret=$((RANDOM)) - echo "::add-mask::$the_secret" - echo "secret-number=$the_secret" >> "$GITHUB_OUTPUT" - - name: Use that secret output (protected by a mask) - run: | - echo "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}" + - name: Fail + if: | + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + run: exit 1