This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
forked from dajiaji/crystals-kyber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (116 loc) · 3.53 KB
/
ci_code.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
119
120
121
122
123
124
125
126
127
128
129
130
name: Code Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build: # cache `npm` folder based on commit hash
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Check for cached folders
id: cache-full
uses: actions/cache@v4
with:
path: |
npm
key: cache-${{ github.sha }}
- name: Run dnt (with tests)
if: steps.cache-full.outputs.cache-hit != 'true'
run: deno task dnt
node:
strategy:
matrix:
node-version: [18.x, 20.x]
name: Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Retrieve cached folders
uses: actions/cache/restore@v4
id: cache-full
with:
path: |
npm
key: cache-${{ github.sha }}
# ignore cache miss, since it was taken care of the `build` step and it should never occur here
- run: |
cd npm
npm ci
npm test
test-browsers-latest:
name: Browsers (latest)
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Retrieve cached built folders
uses: actions/cache/restore@v4
id: cache-full
with:
path: |
npm
key: cache-${{ github.sha }}
- name: Install dependencies
run: |
cd test/runtimes/browsers
npm ci
- name: Get Playwright version
id: playwright-version
run: |
cd test/runtimes/browsers
PLAYWRIGHT_VERSION=$(npm ls playwright | grep playwright | head -n 1 | sed 's/.*@//')
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
- name: Check for cached browsers
id: cache-playwright-browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ steps.playwright-version.outputs.version }}
- name: Install browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: |
cd test/runtimes/browsers
npx playwright install --with-deps chromium
npx playwright install --with-deps firefox
- name: Install WebKit # caching not possible, external shared libraries required
run: |
cd test/runtimes/browsers
npx playwright install --with-deps webkit
- name: Run browser tests
run: |
cd test/runtimes/browsers
npm test
test-browsers-compatibility:
name: Browsers (older, on Browserstack)
runs-on: ubuntu-latest
needs: test-browsers-latest
env: # credentials need hardcoding for now since Github secrets aren't accessible on pull requests from forks
BROWSERSTACK_USERNAME: openpgpjs_PlY4Uq885CQ
BROWSERSTACK_ACCESS_KEY: VjgBVRMxNVBj7SjJFiau
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Retrieve cached dist folder
uses: actions/cache/restore@v4
id: cache-full
with:
path: |
npm
key: cache-${{ github.sha }}
- name: Run browserstack tests
run: |
cd test/runtimes/browsers
npm ci
npm run test-browserstack