oh right, bash doesn't support == #19
Workflow file for this run
This file contains hidden or 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: Test the emit-metrics action | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - feat-emit-metrics-action | |
| permissions: | |
| id-token: write | |
| jobs: | |
| emit-a-metric: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.TEST_CI_AWS_ROLE_ARN }} | |
| aws-region: us-west-2 | |
| - name: Set up kat tool | |
| uses: ./.github/actions/setup-kat | |
| - name: Emit some test metrics | |
| uses: ./.github/actions/emit-metrics | |
| with: | |
| namespace: Test Namespace (ignore me) | |
| dimensions: | | |
| Artifact=foo-artifact | |
| Platform=Kotlin/JVM | |
| Variant=External | |
| metrics: | | |
| BuildTime:4.532:Seconds | |
| BuildSucceeded:1:Count | |
| fail-when-kat-unavailable: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - id: expected-failure | |
| name: Fail to emit some test metrics | |
| uses: ./.github/actions/emit-metrics | |
| continue-on-error: true | |
| with: | |
| namespace: Test Namespace (ignore me) | |
| dimensions: | | |
| Artifact=foo-artifact | |
| Platform=Kotlin/JVM | |
| Variant=External | |
| metrics: | | |
| BuildTime:4.532:Seconds | |
| BuildSucceeded:1:Count | |
| - name: Handle expected failure | |
| shell: bash | |
| run: | | |
| if [[ "${{ steps.expected-failure.outcome }}" -eq "failure" ]]; then | |
| echo Saw expected failure from attempting to emit metrics when kat isn't installed. | |
| exit 0 | |
| else | |
| echo Expected failure from previous step! | |
| exit 1 | |
| fi |