Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): make official releases pass the integration tests first #94

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,32 @@ env:
S3_BUCKET_PREFIX: observeinc

jobs:
permission_check:
runs-on: ubuntu-latest
outputs:
can-write: ${{ steps.check.outputs.can-write }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
steps:
- id: check
run: |
# If the AWS_ACCESS_KEY_ID secret is MIA we can't run tests
if [[ -z "$AWS_ACCESS_KEY_ID" ]]; then
echo "can-write=false" >> $GITHUB_OUTPUT
else
echo "can-write=true" >> $GITHUB_OUTPUT
fi

tests:
needs: permission_check
uses: ./.github/workflows/tests-integration.yaml
if: needs.permission_check.outputs.can-write == 'true'
secrets: inherit

fetch-regions:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
needs: permission_check
if: needs.permission_check.outputs.can-write == 'true'
permissions:
id-token: write
outputs:
Expand All @@ -39,8 +62,11 @@ jobs:
run: echo "matrix=${regions_json}" >> "$GITHUB_OUTPUT"

github-release:
needs: [tests, permission_check]
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
if: >
(needs.permission_check.outputs.can-write == 'true' && github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' && needs.tests.result == 'success')
outputs:
version: ${{ steps.release-version.outputs.VERSION }}
steps:
Expand Down Expand Up @@ -73,7 +99,7 @@ jobs:
VERSION: ${{ (steps.prerelease.outputs.release-version != '') && steps.prerelease.outputs.release-version || steps.fullrelease.outputs.release-version }}

aws-release:
needs: [fetch-regions, github-release]
needs: [fetch-regions, github-release, tests]
runs-on: ubuntu-latest
if: |
github.actor != 'dependabot[bot]' &&
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/tests-integration.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Run IAC Integration Tests

on:
push:
branches:
- main
# push:
# branches:
# - main
# release.yaml runs the tests on commits to main
pull_request:
workflow_dispatch:
workflow_call:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that this is optional when using secrets: inherit but it would be good practice to declare secrets regardless:

https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets

If you don't inherit I'm guessing any explicitly passed secrets would be rejected.


jobs:
permission_check:
runs-on: ubuntu-latest
Expand Down
Loading