Skip to content

Commit

Permalink
feat: extend github actions workflow and undo playwright workaround (#19
Browse files Browse the repository at this point in the history
)
  • Loading branch information
theexiile1305 authored Apr 8, 2024
1 parent 2b9448f commit 3b05c8f
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 193 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/playwright-testing.yml

This file was deleted.

112 changes: 112 additions & 0 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Ensure necessary software quality gates

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Build application
run: pnpm build
quality-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Check with linter
run: pnpm lint
quality-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Check with prettier
run: pnpm prettier:check
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Run unit tests
run: pnpm test:unit
test-e2e:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.43.0-jammy-amd64@sha256:e72111f8087db497b3b7d6b777864cf28270ebef3d001fabe384f4249992179d
env:
HOME: /root
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Build application
run: pnpm build
- name: Run Playwright tests
run: pnpm test:e2e
env:
NEXTAUTH_URL: http://localhost:3000
SHIBBOLETH_OIDC_ISSUER_URL: https://sso.hm.edu
SHIBBOLETH_OIDC_SCOPE: openid
NEXTAUTH_SECRET: topsecret
SHIBBOLETH_OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
SHIBBOLETH_OIDC_CLIENT_SECRET: ${{ secrets.OIDC_CLIENT_SECRET }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results/
retention-days: 30
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
8 changes: 1 addition & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,13 @@ next-test:

next-test-e2e:
stage: quality
### BEGIN WORKAROUND
# use the Playwright image for e2e tests, until update to version 1.43.x occurred. Actual bug in Playwright 1.42.1
# --> https://github.com/microsoft/playwright/issues/29925
# image: mcr.microsoft.com/playwright:v1.42.1-jammy@sha256:b2b78a74b04b3cfdf35046c623c49741de35ef67f1b4a21de8e316dbb89fe68e
image: docker.io/node:21.7.2-bookworm@sha256:fa5e7e628c8fe0ebfd13239b0103de36df36903fc7fee18da9755d022b2b910f
image: mcr.microsoft.com/playwright:v1.43.0-jammy-amd64@sha256:e72111f8087db497b3b7d6b777864cf28270ebef3d001fabe384f4249992179d
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
- pnpm i --frozen-lockfile
- pnpm build
- npx playwright install --with-deps
### END WORKAROUND
script:
- NEXTAUTH_URL=http://localhost:3000
SHIBBOLETH_OIDC_ISSUER_URL=https://sso.hm.edu
Expand Down
2 changes: 1 addition & 1 deletion config/defineConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ const loadString = (env: string | undefined): string => {

const loadBoolean = (env: string | undefined): boolean => {
if (env === undefined) return false;
return JSON.parse(loadString(env).toLowerCase());
return JSON.parse(env.toLowerCase());
};
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default [
{
rules: {},
},
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@types/node": "20.12.5",
"@types/react": "18.2.74",
"@types/react-dom": "18.2.24",
"eslint": "9.0.0",
"eslint": "8.56.0",
"eslint-config-next": "14.1.4",
"next": "14.1.4",
"next-auth": "^4.24.7",
Expand Down
Loading

0 comments on commit 3b05c8f

Please sign in to comment.