-
Notifications
You must be signed in to change notification settings - Fork 3
118 lines (101 loc) · 3.32 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Deploy CardFoldr to GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Inject version information
run: |
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
jq -n --arg commit "$GITHUB_SHA" --arg build "$GITHUB_RUN_NUMBER" --arg date "$DATE" '{commit: $commit, build: $build, date: $date}' > ./src/version.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./src
# Test job
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 🏗 Prepare Playwright env
working-directory: ./tests
run: |
npm ci
PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: 🧰 Cache Playwright browser binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: "~/.cache/ms-playwright"
key: "${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}"
restore-keys: |
${{ runner.os }}-playwright-
- name: 🏗 Install Playwright browser binaries & OS dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./tests
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install --with-deps
- name: 🏗 Install Playwright OS dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: ./tests
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install-deps
- name: 🏗 Install extra PDF compare dependencies
run: |
sudo apt-get update
sudo apt-get install graphicsmagick
sudo apt-get install imagemagick
sudo apt-get install ghostscript
# Change ImageMagick policy to allow pdf -> png conversion
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
- name: 🎭 Run Playwright
working-directory: ./tests
run: |
npx playwright test
- name: ⬆ Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: tests/playwright-report
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4