Skip to content

Commit

Permalink
update test workflow to callable
Browse files Browse the repository at this point in the history
  • Loading branch information
zachariahmiller authored Oct 7, 2024
1 parent 828581f commit 8cf787b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:
workflow_call:

jobs:
run:
validate:
uses: defenseunicorns/uds-common/.github/workflows/callable-lint.yaml@0780ed64a7b76920526046b8c3b8c7251a4bf2f0 # v1.0.0
secrets: inherit
105 changes: 41 additions & 64 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,62 @@
name: Test

# This workflow is triggered on pull requests to the main branch.
on:
# This workflow is triggered on pull requests to the main branch.
pull_request:
branches: [main]
types: [milestoned, opened, synchronize]
# milestoned is added here as a workaround for release-please not triggering PR workflows (PRs should be added to a milestone to trigger the workflow).
types: [milestoned, opened, reopened, synchronize]
paths-ignore:
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"
- ".gitignore"
- "renovate.json"
- ".release-please-config.json"
- "release-please-config.json"
- "oscal-component.yaml"
- "CODEOWNERS"
- "LICENSE"
- "CONTRIBUTING.md"
- "SECURITY.md"
- adr/**
- docs/**
- .gitignore
- renovate.json
- .release-please-config.json
- release-please-config.json
- CODEOWNERS
- LICENSE
- CONTRIBUTING.md
- SECURITY.md
- config/renovate.json5

# Permissions for the GITHUB_TOKEN used by the workflow.
permissions:
contents: read # Allows reading the content of the repository.
packages: read # Allows reading the content of the repository's packages.
id-token: write

# Abort prior jobs in the same workflow / PR
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
id-token: write

jobs:
run-test:
name: ${{ matrix.type }} ${{ matrix.flavor }}
runs-on: 'uds-swf-ubuntu-big-boy-4-core'
timeout-minutes: 20
strategy:
matrix:
flavor: [upstream, unicorn, registry1]
type: [install, upgrade]
# do not run upgrade tests for unicorn
# TODO @WSTARR: remove after first unicorn release
exclude:
- flavor: unicorn
type: upgrade

check-flavor:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@0780ed64a7b76920526046b8c3b8c7251a4bf2f0 # v1.0.0
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
chainguardIdentity: ${{ secrets.CHAINGUARD_IDENTITY }}

- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Test
uses: defenseunicorns/uds-common/.github/actions/test@0780ed64a7b76920526046b8c3b8c7251a4bf2f0 # v1.0.0
with:
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}

- name: Debug Output
if: ${{ always() }}
uses: defenseunicorns/uds-common/.github/actions/debug-output@0780ed64a7b76920526046b8c3b8c7251a4bf2f0 # v1.0.0
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Save logs
if: always()
uses: defenseunicorns/uds-common/.github/actions/save-logs@0780ed64a7b76920526046b8c3b8c7251a4bf2f0 # v1.0.0
with:
suffix: ${{ matrix.type }}-${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: test-flavor
uses: ./.github/actions/test-flavor
id: test-flavor
outputs:
upgrade-flavors: ${{ steps.test-flavor.outputs.upgrade-flavors }}

- uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
if: always()
with:
name: playwright-report-${{ matrix.type }}-${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}
path: tests/.playwright/reports/
retention-days: 30
validate:
needs: check-flavor
strategy:
fail-fast: false
matrix:
type: [install, upgrade]
flavor: [upstream, unicorn, registry1]
uses: defenseunicorns/uds-common/.github/workflows/callable-test.yaml@/additional_artifacts
with:
upgrade-flavors: ${{ needs.check-flavor.outputs.upgrade-flavors }}
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}
secrets: inherit # Inherits all secrets from the parent workflow.

0 comments on commit 8cf787b

Please sign in to comment.