Skip to content

Nightly swat tests

Nightly swat tests #28

# Github action to run swatomation tests nightly
name: Nightly swat tests
on:
schedule:
- cron: "30 9 * * *"
workflow_dispatch:
env:
RUN_NAME: '${{ github.event.repository.name }}-${{ github.run_id }}-${{ github.run_attempt }}'
jobs:
prepare-configs:
runs-on: ubuntu-latest
outputs:
custom-version-json: ${{ steps.build-custom-version-json.outputs.custom-version-json }}
test-context: ${{ steps.prepare-outputs.outputs.test-context }}
tag: ${{ steps.get-latest-tag.outputs.tag }}
steps:
- uses: 'actions/checkout@v4'
with:
ref: develop
fetch-tags: true
- id: get-latest-tag
run: |
echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT
- id: build-custom-version-json
name: Publish Orch
run: |
echo 'custom-version-json={\"firecloudorch\":{\"appVersion\":\"${{ steps.get-latest-tag.outputs.tag }}\"}}' >> $GITHUB_OUTPUT
- id: prepare-outputs
run: |-
echo 'log-results=true' >> $GITHUB_OUTPUT
echo 'test-context=nightly' >> $GITHUB_OUTPUT
create-bee-workflow:
strategy:
matrix:
terra-env: [ dev ] # what versions of apps do we use to emulate types of environments
runs-on: ubuntu-latest
needs: [prepare-configs]
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Echo Orch version
run: |
echo '${{ needs.prepare-configs.outputs.custom-version-json }}'
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v4
with:
workflow: bee-create
run-name: "bee-create-${{ env.RUN_NAME }}"
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ secrets.BROADBOT_TOKEN}} # github token for access to kick off a job in the private repo
# manually recalculate b/c env context is broken https://github.com/actions/runner/issues/480
# Note: There is a hard limit of bee-name not exceeding 32 characters
inputs: '{
"bee-name": "orch-${{ github.run_id }}-${{ matrix.terra-env }}",
"version-template": "${{ matrix.terra-env }}",
"custom-version-json": "${{ needs.prepare-configs.outputs.custom-version-json }}",
"run-name": "bee-create-${{ env.RUN_NAME }}"
}'
orch-swat-test-job:
strategy:
matrix:
terra-env: [ dev ] # what versions of apps do we use to emulate types of environments
testing-env: [ qa ] # what env resources to use, e.g. SA keys
runs-on: ubuntu-latest
needs: [prepare-configs, create-bee-workflow]
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v4
with:
workflow: orch-swat-tests
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ secrets.BROADBOT_TOKEN}} # github token for access to kick off a job in the private repo
# manually recalculate b/c env context is broken https://github.com/actions/runner/issues/480
inputs: '{
"bee-name": "orch-${{ github.run_id }}-${{ matrix.terra-env }}",
"ENV": "${{ matrix.testing-env }}",
"test-context": "${{ needs.prepare-configs.outputs.test-context }}",
"ref": "${{ needs.prepare-configs.outputs.tag }}"
}'
# github.head_ref, used above, is only populated for PRs and will be blank when merging to develop.
# This is ok; the orch-swat-tests workflow uses "develop" as a default when receiving a blank value.
destroy-bee-workflow:
strategy:
matrix:
terra-env: [ dev ] # what versions of apps do we use to emulate types of environments
runs-on: ubuntu-latest
needs: [orch-swat-test-job]
if: always() # always run to confirm bee is destroyed
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: dispatch to terra-github-workflows
uses: broadinstitute/workflow-dispatch@v4
with:
workflow: bee-destroy
run-name: "bee-destroy-${{ env.RUN_NAME }}"
repo: broadinstitute/terra-github-workflows
ref: refs/heads/main
token: ${{ secrets.BROADBOT_TOKEN}} # github token for access to kick off a job in the private repo
# manually recalculate b/c env context is broken https://github.com/actions/runner/issues/480
inputs: '{
"bee-name": "orch-${{ github.run_id }}-${{ matrix.terra-env }}",
"run-name": "bee-destroy-${{ env.RUN_NAME }}"
}'
wait-for-completion: false