Merge pull request #5 from CDCgov/marcelle/pare-workflow #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test tefca-viewer Container | |
on: | |
pull_request: | |
branches: | |
- "**" | |
merge_group: | |
types: | |
- checks_requested | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- pyproject.toml | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TEST_RUNNER_PYTHON_VERSION: 3.10.12 | |
CONTAINER: tefca-viewer | |
NODE_VERSION: 18 # Adjust the Node.js version as needed | |
jobs: | |
javascript-linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint javascript for ${{env.CONTAINER}} | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: | | |
npm ci | |
npm run lint | |
test-node-containers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- name: Install dependencies | |
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory | |
run: npm install | |
- name: Run tests | |
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory | |
run: npm test | |
build-container: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Check Out Changes | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build ${{ env.CONTAINER }} Container | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./containers/${{ env.CONTAINER }}/Dockerfile | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
playwright-tests: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- name: Install dependencies | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: npm ci | |
- name: Install Playwright Browsers | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: npx playwright install --with-deps | |
- name: Build Query Connector | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: docker compose build --no-cache | |
- name: Run Query Connector | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: docker compose up -d | |
- name: Poll until Query Connector is ready | |
run: | | |
until curl -s http://localhost:3000/tefca-viewer; do | |
echo "Waiting for Query Connector to be ready before running Playwright..." | |
sleep 5 | |
done | |
- name: Playwright Tests | |
working-directory: ./containers/${{env.CONTAINER}} | |
run: npx playwright test e2e --reporter=list --config playwright.config.ts |