-
Notifications
You must be signed in to change notification settings - Fork 266
101 lines (87 loc) · 3.3 KB
/
lint-and-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
name: Lint and test
on:
pull_request:
push:
branches:
- main
jobs:
lint:
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: "18"
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: "Checking lint errors"
run: |
pnpm --filter ...[${{ steps.since.outputs.SINCE }}] lint:check
- name: "Checking format errors"
run: |
pnpm --filter ...[${{ steps.since.outputs.SINCE }}] format:check
- name: Check types
run: pnpm --filter ...[${{ steps.since.outputs.SINCE }}] type-check
- name: Test
run: VCR_MODE=playback pnpm --filter ...[${{ steps.since.outputs.SINCE }}] test
env:
HF_ACCESS_TOKEN: ${{ secrets.HF_ACCESS_TOKEN }}
- name: Test in browser
run: VCR_MODE=playback pnpm --filter ...[${{ steps.since.outputs.SINCE }}] test:browser
env:
HF_ACCESS_TOKEN: ${{ secrets.HF_ACCESS_TOKEN }}
- 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 inference --filter hub --frozen-lockfile
pnpm --filter inference --filter hub 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 install --registry http://localhost:4874/
- 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_ACCESS_TOKEN }}
- name: E2E test - svelte app build
working-directory: e2e/svelte
run: |
pnpm i --ignore-workspace --registry http://localhost:4874/
pnpm build
- 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 index.ts
env:
NPM_CONFIG_REGISTRY: http://localhost:4874/