Skip to content

Commit

Permalink
chore: cache playwright and add tests to amd64 release (#155)
Browse files Browse the repository at this point in the history
## Description

This splits the playwright install step and adds caching to speed up CI tests

## Related Issue

Fixes #139 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Other (security config, docs update, etc)

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/uds-package-gitlab/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
Racer159 committed Jun 20, 2024
1 parent e5a8f66 commit 4af9d3a
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
validate:
name: Validate
uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
fetch-depth: 0

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Install lint deps
run: |
uds run lint:deps
uds run lint:deps --no-progress
- name: Lint the repository
run: |
uds run lint:yaml
uds run lint:yaml --no-progress
39 changes: 31 additions & 8 deletions .github/workflows/tag-and-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish UDS Package Gitlab
name: Publish UDS Package GitLab

on:
push:
Expand All @@ -22,11 +22,17 @@ jobs:
publish-package:
needs: tag-new-version
if: ${{ needs.tag-new-version.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
name: Publish ${{ matrix.flavor }}
# TODO: (@WSTARR) since we don't run the tests on arm currently we don't need to use the 8 core
runs-on: ${{ matrix.architecture == 'arm64' && 'uds-ubuntu-arm64-4-core' || 'uds-ubuntu-big-boy-8-core' }}
name: Publish ${{ matrix.flavor }} ${{ matrix.architecture }}
timeout-minutes: 40
strategy:
matrix:
flavor: [upstream, registry1]
architecture: [amd64, arm64]
exclude:
- flavor: registry1
architecture: arm64

permissions:
contents: read
Expand All @@ -36,21 +42,38 @@ jobs:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Playwright setup
uses: defenseunicorns/uds-common/.github/actions/playwright@0901c37366f37fea586768c79708e14e964e714e # v0.6.1

- name: Build Package
run: uds run -f tasks/publish.yaml build-package --set FLAVOR=${{ matrix.flavor }}

- name: Build Bundle
run: uds run -f tasks/publish.yaml build-test-bundle --set FLAVOR=${{ matrix.flavor }}

- name: Test Package
if: ${{ runner.arch != 'ARM64' }}
run: uds run -f tasks/publish.yaml test-package --set FLAVOR=${{ matrix.flavor }}

- name: Publish Package
run: uds run -f tasks/publish.yaml package --set FLAVOR=${{ matrix.flavor }}
run: uds run -f tasks/publish.yaml publish-package --set FLAVOR=${{ matrix.flavor }}

- name: Publish Bundle
if: ${{ matrix.flavor == 'upstream' }}
run: uds run -f tasks/publish.yaml test-bundle --set FLAVOR=${{ matrix.flavor }}
run: uds run -f tasks/publish.yaml publish-test-bundle --set FLAVOR=${{ matrix.flavor }}

- name: Debug Output
if: ${{ always() }}
uses: defenseunicorns/uds-common/.github/actions/debug-output@0901c37366f37fea586768c79708e14e964e714e # v0.6.1

- name: Save logs
if: always()
uses: defenseunicorns/uds-common/.github/actions/save-logs@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/save-logs@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
suffix: '${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}'
suffix: '${{ matrix.flavor }}-${{ matrix.architecture }}-${{ github.run_id }}-${{ github.run_attempt }}'
13 changes: 10 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,28 @@ jobs:
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Environment setup
uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}

- name: Playwright setup
uses: defenseunicorns/uds-common/.github/actions/playwright@0901c37366f37fea586768c79708e14e964e714e # v0.6.1

- name: Test
uses: defenseunicorns/uds-common/.github/actions/test@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/test@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
flavor: ${{ matrix.flavor }}
type: ${{ matrix.type }}

- name: Debug Output
if: ${{ always() }}
uses: defenseunicorns/uds-common/.github/actions/debug-output@0901c37366f37fea586768c79708e14e964e714e # v0.6.1

- name: Save logs
if: always()
uses: defenseunicorns/uds-common/.github/actions/save-logs@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5
uses: defenseunicorns/uds-common/.github/actions/save-logs@0901c37366f37fea586768c79708e14e964e714e # v0.6.1
with:
suffix: ${{ matrix.type }}-${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

This package is designed for use as part of a [UDS Software Factory](https://github.com/defenseunicorns/uds-software-factory) bundle deployed on [UDS Core](https://github.com/defenseunicorns/uds-core), and is based on the Bigbang [GitLab](https://repo1.dso.mil/big-bang/product/packages/gitlab) chart.

> [!IMPORTANT]
> The `arm64` package includes `amd64` images due to lack of availability of `arm64` images from upstream projects at this time. This means you can deploy the `arm64` package on an `arm64` kubernetes cluster, but some of the images contained in the package will require emulation (e.g., qemu or rosetta) to run properly.
## Pre-requisites

The GitLab Package expects to be deployed on top of [UDS Core](https://github.com/defenseunicorns/uds-core) with the dependencies listed below being configured prior to deployment.
Expand Down
20 changes: 7 additions & 13 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ includes:
- cleanup: ./tasks/cleanup.yaml
- dependencies: ./tasks/dependencies.yaml
- test: ./tasks/test.yaml
- create: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/create.yaml
- lint: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/lint.yaml
- pull: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/pull.yaml
- deploy: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/deploy.yaml
- setup: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/setup.yaml
- create: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/create.yaml
- lint: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/lint.yaml
- pull: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/pull.yaml
- deploy: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/deploy.yaml
- setup: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/setup.yaml

tasks:
- name: default
Expand Down Expand Up @@ -54,10 +54,7 @@ tasks:
- task: setup:k3d-test-cluster
- task: deploy:test-bundle
- task: setup:create-doug-user
- task: test:health-check
- task: test:ingress
- task: test:ui
- task: test:git
- task: test:all

- name: test-upgrade
description: Test an upgrade from the latest released package to the current branch
Expand All @@ -68,7 +65,4 @@ tasks:
- task: create-gl-test-bundle
- task: deploy:test-bundle
- task: setup:create-doug-user
- task: test:health-check
- task: test:ingress
- task: test:ui
- task: test:git
- task: test:all
58 changes: 25 additions & 33 deletions tasks/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,44 @@
includes:
- dependencies: ./dependencies.yaml
- create: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/create.yaml
- publish: https://github.com/raw/defenseunicorns/uds-common/v0.4.5/tasks/publish.yaml
- test: ./test.yaml
- create: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/create.yaml
- deploy: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/deploy.yaml
- publish: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/publish.yaml
- setup: https://github.com/raw/defenseunicorns/uds-common/v0.6.1/tasks/setup.yaml

tasks:
- name: package
description: Build and publish the packages
- name: build-package
description: Build package
actions:
- description: Create the AMD64 package
task: create:package
with:
architecture: amd64
- task: create:package

- description: Create the ARM64 package
task: create:package
with:
architecture: arm64
- name: build-test-bundle
description: Build the test bundle
actions:
- task: dependencies:create
- task: create:test-bundle

- name: test-package
description: Test the package
actions:
- task: setup:k3d-test-cluster
- task: deploy:test-bundle
- task: setup:create-doug-user
- task: test:all

- name: publish-package
description: Build and publish the packages
actions:
- description: Publish the packages
task: publish:package
with:
# x-release-please-start-version
version: "17.0.1-uds.1"
# x-release-please-end

- name: test-bundle
- name: publish-test-bundle
description: Build and publish the test bundles
actions:
- description: Create the ARM64 deps package
task: dependencies:create
with:
architecture: amd64

- description: Create the ARM64 deps package
task: dependencies:create
with:
architecture: arm64

- description: Create the AMD64 bundle
task: create:test-bundle
with:
architecture: amd64

- description: Create the ARM64 bundle
task: create:test-bundle
with:
architecture: arm64

- description: Publish the bundles
task: publish:test-bundle
with:
Expand Down
18 changes: 14 additions & 4 deletions tasks/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ variables:
default: glpat-NO_DEFAULT_VALUE

tasks:
- name: all
actions:
- task: test:health-check
- task: test:ingress
- task: test:ui
- task: test:git

- name: health-check
actions:
- description: GitLab Exporter Health Check
Expand Down Expand Up @@ -112,10 +119,6 @@ tasks:
- name: ui
description: GitLab UI Checks
actions:
- cmd: npm ci
dir: tests
- cmd: npx playwright install --with-deps
dir: tests
- cmd: npx playwright test
dir: tests

Expand Down Expand Up @@ -149,3 +152,10 @@ tasks:
actions:
- description: Get the root password for GitLab (useful for local dev)
cmd: ./uds zarf tools kubectl get secret -n gitlab gitlab-gitlab-initial-root-password -o jsonpath={.data.password} | base64 -d

- name: install-playwright-deps
actions:
- cmd: npm ci
dir: tests
- cmd: npx playwright install --with-deps
dir: tests
6 changes: 3 additions & 3 deletions tests/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { test as setup, expect } from '@playwright/test';
import { authFile } from './playwright.config';

setup('authenticate', async ({ page, context }) => {
await page.goto('/');
await page.goto('/dashboard/projects');

await page.getByLabel('Username or email').fill('doug');
await page.getByLabel('Password').fill('unicorn123!@#');
await page.getByRole('button', { name: "Log In" }).click();

await page.waitForURL('/'); // successful redirect
await page.waitForURL('/dashboard/projects'); // successful redirect

// ensure auth cookies were set
const cookies = await context.cookies();
Expand All @@ -22,5 +22,5 @@ setup('authenticate', async ({ page, context }) => {

await page.context().storageState({ path: authFile });

await expect(page).toHaveURL('/');
await expect(page).toHaveURL('/dashboard/projects');
})

0 comments on commit 4af9d3a

Please sign in to comment.