diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0b768cf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: ci + +on: pull_request + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: asdf-vm/actions/install@v3 + with: + tool_versions: | + action-validator 0.5.1 + - run: asdf reshim action-validator + - run: action-validator ./action.yml + - run: action-validator ./.github/workflows/ci.yml + + test: + needs: lint + runs-on: ubuntu-latest + name: test-${{ matrix.env }} + strategy: + matrix: + env: + - production + - staging + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + config-production: 'foo' + config-staging: 'bar' + environment: ${{ matrix.env }} + + test_failure: + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + continue-on-error: true + id: fail-step + with: + config-production: 'foo' + config-staging: 'bar' + environment: stage + - if: steps.fail-step.outcome == 'success' + run: exit 1 diff --git a/action.yml b/action.yml index b16816e..2781c62 100644 --- a/action.yml +++ b/action.yml @@ -4,11 +4,7 @@ inputs: environment: required: true description: the environment to deploy to - type: choice default: staging - options: - - staging - - production config-production: required: true description: k8s configuration for production @@ -21,6 +17,11 @@ inputs: runs: using: "composite" steps: + - shell: bash + run: | + echo "Unknown environment: ${{ inputs.environment }}" + exit 1 + if: (inputs.environment != 'production' && inputs.environment != 'staging') - uses: yokawasa/action-setup-kube-tools@v0.9.2 with: kubectl: '1.27.5'