Skip to content

add-frontend-smoke

add-frontend-smoke #26

Workflow file for this run

name: Integration Tests
on:
workflow_run:
workflows: ["Docker Bake Build and Push"]
types: [completed]
workflow_dispatch:
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
integration:
# Only run for trusted sources: manual dispatch or bake workflow on this repo/push
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_repository.full_name == github.repository) ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
XDG_RUNTIME_DIR: /tmp/podman-run
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Install podman
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Start podman socket service
run: |
mkdir -p "$XDG_RUNTIME_DIR/podman"
podman system service --time=0 unix://$XDG_RUNTIME_DIR/podman/podman.sock >/tmp/podman-service.log 2>&1 &
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: frontend/interactEM/package-lock.json
- name: Install frontend dependencies
working-directory: frontend/interactEM
run: npm ci
- name: Install Playwright browsers (with system deps)
working-directory: frontend/interactEM
run: npx playwright install --with-deps
- name: Prepare .env
run: make setup
- name: Set image tags
run: |
TAG=$(git rev-parse --short=6 HEAD)
echo "TAG=$TAG" >> $GITHUB_ENV
REGISTRY=ghcr.io/nersc/interactem
for name in BACKEND FRONTEND ORCHESTRATOR CALLOUT LAUNCHER METRICS AGENT OPERATOR; do
image=$(echo "$name" | tr '[:upper:]' '[:lower:]')
echo "DOCKER_IMAGE_${name}=${REGISTRY}/${image}" >> $GITHUB_ENV
done
- name: Login to GHCR (for cache/images)
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' &&
github.event.workflow_run.head_repository.full_name == github.repository) ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Pull images built by bake workflow
id: pull
continue-on-error: true
run: docker compose pull
- name: Build images with bake (use cache, no push)
if: steps.pull.outcome == 'failure'
uses: docker/bake-action@v6
with:
source: .
files: |
docker/docker-bake.hcl
docker/docker-bake-ci.hcl
targets: prod
set: |
*.platform=linux/amd64
*.output=type=docker
env:
TAG: ${{ env.TAG }}
REGISTRY: ghcr.io/nersc/interactem
CACHE_PLATFORM: amd64
- name: Start stack
run: |
USER_ID=$(id -u) GROUP_ID=$(id -g) docker compose up --force-recreate --remove-orphans -d
- name: Run integration tests
run: make integration-test
- name: Upload Playwright report
if: always() && (hashFiles('frontend/interactEM/playwright-report/**') != '')
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/interactEM/playwright-report
if-no-files-found: ignore
- name: Stop containers
if: always()
run: make docker-down
- name: Show docker compose logs on failure
if: failure()
run: docker compose logs --no-color