Skip to content

Test example positive #48

Test example positive

Test example positive #48

Workflow file for this run

name: Test example positive
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
pull_request: {}
workflow_dispatch: {}
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"
test:
strategy:
matrix:
include:
- env: preview
expected-namespace: app-ns
- env: preview-prs
expected-namespace: app-pr-undefined # undefined here because this is called through dispatch
- env: production
expected-namespace: foo-bar-zyx
- env: dev
expected-namespace: dev
expected-cluster-role: arn:aws:iam::123456789012:role/my-gha-cluster-role
- env: custom
expected-foo: bar
expected-namespace: dev
expected-service-config-ssm-path: service/app/config/custom/app-ns
- env: long
expected-namespace: long-namespace
env: [preview, preview-prs, production, dev]
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./
id: current
with:
environment: ${{ matrix.env }}
namespace: ns
application: "app"
config: |
preview:
cluster: cluster-preview
namespace: ${{inputs.namespace}}
reformat: branch-name
preview-prs:
cluster: cluster-preview-prs
namespace: bar-123
reformat: pr-number
production:
cluster: cluster-production
namespace: Foo_Bar/ZYX | kebabcase
dev:
cluster: cluster-dev
namespace: dev
cluster-role: arn:aws:iam::123456789012:role/my-gha-cluster-role
custom:
cluster: dev
namespace: dev
cluster-role: foo
service-config-ssm-path: service/app/config/custom/app-ns
foo: bar
long:
cluster: cluster-preview
namespace: ${{inputs.namespace}}
reformat: branch-name
- uses: nick-fields/assert-action@v1
with:
actual: "${{ steps.current.outputs.namespace }}"
expected: '${{ matrix.expected-namespace }}'
- uses: nick-fields/assert-action@v1
if: ${{ matrix.expected-cluster-role }}
with:
actual: "${{ steps.current.outputs.role }}"
expected: '${{ matrix.expected-cluster-role }}'
- name: Environment info
uses: cloudposse/github-action-yaml-config-query@0.1.0
id: result
with:
query: .
config: ${{ steps.current.outputs.environment-config }}
- uses: nick-fields/assert-action@v1
if: ${{ matrix.expected-foo }}
with:
actual: "${{ steps.result.outputs.foo }}"
expected: '${{ matrix.expected-foo }}'
- uses: nick-fields/assert-action@v1
if: ${{ matrix.expected-service-config-ssm-path }}
with:
actual: "${{ steps.result.outputs.service-config-ssm-path }}"
expected: '${{ matrix.expected-service-config-ssm-path }}'
teardown:
runs-on: ubuntu-latest
needs: [test]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"