Skip to content

add e2e tests and update deploy workflow #79

add e2e tests and update deploy workflow

add e2e tests and update deploy workflow #79

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
name: gh-pages
on:
# Runs on push or pull_request merge targeting the default branch
push:
branches:
- "main"
schedule:
- cron: "30 7 21 * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
issues: write
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
script-dependencies:
name: Updates Ontologies' JSON files
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
shell: bash
run: |
python -m venv virtenv
source virtenv/bin/activate
pip install -r scripts/requirements.txt
- name: Cache virtualenv
uses: actions/cache@v3
with:
path: virtenv
key: venv
test-code:
name: Test script
runs-on: ubuntu-20.04
needs: script-dependencies
steps:
- uses: actions/checkout@v3
- name: Restore virtualenv
uses: actions/cache@v3
with:
path: virtenv
key: venv
- name: Test code
shell: bash
run: |
source virtenv/bin/activate
pytest scripts
json-generation:
name: Generate JSON files
runs-on: ubuntu-20.04
needs: test-code
steps:
- uses: actions/checkout@v3
- name: Restore virtualenv
uses: actions/cache@v3
with:
path: virtenv
key: venv
- name: Generate JSON files
shell: bash
run: |
source virtenv/bin/activate
mkdir scripts/ontologies
PYTHONPATH=scripts python scripts/ontoserpy/main.py ontologies.txt scripts/ontologies
- name: Upload JSON files
uses: actions/upload-artifact@v3
with:
name: ontologies
path: ./scripts/ontologies
notify-job:
runs-on: ubuntu-20.04
needs: [json-generation, test-code]
name: Create failure issue
if: ${{ failure() }}
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: create-issue
- run: "echo Created issue number ${{ steps.create-issue.outputs.number }}"
- run: "echo Created ${{ steps.create-issue.outputs.url }}"
frontend-dependencies:
name: Install frontend dependencies
runs-on: ubuntu-20.04
needs: json-generation
outputs:
STORE_PATH: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
working-directory: ./frontend
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
key: pnpm
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
- name: Install dependencies
working-directory: ./frontend
run: pnpm install --prod
build:
name: Build Svelte static site
needs: frontend-dependencies
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Create directories
working-directory: ./frontend
shell: bash
run: |
mkdir ./src/lib/assets/ontologies
mkdir ./static/public
- name: Download ontologies and move it to the directory
uses: actions/download-artifact@v3
with:
name: ontologies
path: ./frontend/src/lib/assets/ontologies
- name: Create soft link to public directory
working-directory: ./frontend/static/public
shell: bash
run: ln -s ../../src/lib/assets/ontologies/* .
- name: Restore PNPM packages
uses: actions/cache@v3
with:
key: pnpm
path: ${{ needs.frontend-dependencies.outputs.STORE_PATH }}
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true
- name: Build
working-directory: ./frontend
shell: bash
run: NODE_OPTIONS=--max-old-space-size=8192 pnpm build
- name: Upload Build
uses: actions/upload-artifact@v3
with:
name: build
path: ./frontend/build
deploy:
name: gh pages
needs: build
runs-on: ubuntu-20.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: .
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
e2e:
name: E2E testing
needs: [deploy, frontend-dependencies]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Restore PNPM packages
uses: actions/cache@v3
with:
key: pnpm
path: ${{ needs.frontend-dependencies.outputs.STORE_PATH }}
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true
- name: Install Playwright
working-directory: ./frontend
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
working-directory: ./frontend
run: pnpm exec playwright test
- uses: actions/upload-artifact@v3
working-directory: ./frontend

Check failure on line 220 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / gh-pages

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 220, Col: 9): Unexpected value 'working-directory'
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30