-
Notifications
You must be signed in to change notification settings - Fork 240
142 lines (122 loc) · 4.55 KB
/
test.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
131
132
133
134
135
136
137
138
139
140
141
142
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
node:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
# Could use something like rmacklin/fetch-through-merge-base@v0 instead when the repo gets bigger
fetch-depth: 0
- name: "Extracting the merge base into 'SINCE'"
id: since
run: |
if [ -z "${{ github.event.pull_request.head.ref }}" ]
then
echo "SINCE=${{ github.sha }}^1" >> $GITHUB_OUTPUT
else
echo "SINCE=$(git merge-base origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})" >> $GITHUB_OUTPUT
fi
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: |
pnpm install --frozen-lockfile --filter .
pnpm install --frozen-lockfile --filter ...[${{ steps.since.outputs.SINCE }}]...
pnpm --filter ...[${{ steps.since.outputs.SINCE }}]... build
- name: Test
run: VCR_MODE=playback pnpm --filter ...[${{ steps.since.outputs.SINCE }}] test
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
browser:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
# Could use something like rmacklin/fetch-through-merge-base@v0 instead when the repo gets bigger
fetch-depth: 0
- name: "Extracting the merge base into 'SINCE'"
id: since
run: |
if [ -z "${{ github.event.pull_request.head.ref }}" ]
then
echo "SINCE=${{ github.sha }}^1" >> $GITHUB_OUTPUT
else
echo "SINCE=$(git merge-base origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})" >> $GITHUB_OUTPUT
fi
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: |
pnpm install --frozen-lockfile --filter .
pnpm install --frozen-lockfile --filter ...[${{ steps.since.outputs.SINCE }}]...
pnpm --filter ...[${{ steps.since.outputs.SINCE }}]... build
- name: Test in browser
run: VCR_MODE=playback pnpm --filter ...[${{ steps.since.outputs.SINCE }}] test:browser
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
e2e:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- name: E2E - start mock npm registry
run: |
npm i -g verdaccio verdaccio-memory verdaccio-auth-memory
echo >> .npmrc
echo "//localhost:4874/:_authToken=1FlYaQkIdHsIztXCHmqu9g==" >> .npmrc
npx verdaccio --listen 4874 --config e2e/mock-registry-config.yaml &
- name: E2E test - publish packages to mock repo
working-directory: e2e
run: |
sleep 3
pnpm i --filter root --filter inference... --filter hub... --filter tasks-gen --frozen-lockfile
pnpm --filter inference --filter hub --filter tasks publish --force --no-git-checks --registry http://localhost:4874/
- name: E2E test - test yarn install
working-directory: e2e/ts
run: |
npm i -g yarn --force
# yarn now looks at root package.json for the package manager...
mv ../../package.json ../../package.json.bk
yarn install --registry http://localhost:4874/
mv ../../package.json.bk ../../package.json
- name: E2E test - typescript node project
working-directory: e2e/ts
run: |
pnpm i --ignore-workspace --registry http://localhost:4874/
pnpm start
env:
token: ${{ secrets.HF_TOKEN }}
- name: E2E test - svelte app build
working-directory: e2e/svelte
run: |
pnpm i --ignore-workspace --registry http://localhost:4874/
pnpm build
pnpm run test:browser
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: E2E test - deno import from npm
working-directory: e2e/deno
run: deno run --allow-net --allow-env=HF_TOKEN index.ts
env:
NPM_CONFIG_REGISTRY: http://localhost:4874/
HF_TOKEN: ${{ secrets.HF_TOKEN }}