-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (128 loc) · 4.64 KB
/
pr.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
name: PR
on:
pull_request:
types: [opened, synchronize, reopened, closed]
# cancel previous runs when the PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
# Full setup required since building the JS SDK requires Go
- name: Setup
uses: ./.github/actions/setup-all
with:
node_version: 20.10.0
go_version: 1.21.7
- name: Commit lint
shell: bash
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
- name: Lint TypeScript
shell: bash
run: npx nx affected --target=lint --parallel=5
# The SDK is referenced via dist in the tsconfig.base.json
# because the next executor does not actually support
# buildLibsFromSource=false
# With this configuration NX does not build the SDK as expected
# when it is an app dependency
- name: Force build SDK
shell: bash
run: npx nx run sdk:build
- name: Test TypeScript
shell: bash
run: npx nx affected --target=test --parallel=5
- name: Build
shell: bash
run: npx nx affected --target=build --configuration=production --parallel=5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
- name: Export
shell: bash
# issue with parallelism
run: npx nx affected --target=build --configuration=export --parallel=5
test-e2e:
runs-on: ubuntu-latest
# Only run one test-e2e job at a time because they mutate the same data
concurrency: test-e2e
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
# Full setup required since building the JS SDK requires Go
- name: Setup
uses: ./.github/actions/setup-all
with:
node_version: 20.10.0
go_version: 1.21.7
# The SDK is referenced via dist in the tsconfig.base.json
# because the next executor does not actually support
# buildLibsFromSource=false
# With this configuration NX does not build the SDK as expected
# when it is an app dependency
- name: Force build SDK
shell: bash
run: npx nx run sdk:build
- name: Install playwright deps for e2e
shell: bash
run: npx playwright install-deps
- name: Test e2e
shell: bash
run: npx nx affected --target=e2e --parallel=5
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
RENTERD_E2E_TEST_API_URL: ${{ secrets.RENTERD_E2E_TEST_API_URL }}
RENTERD_E2E_TEST_API_PASSWORD: ${{ secrets.RENTERD_E2E_TEST_API_PASSWORD }}
HOSTD_E2E_TEST_API_URL: ${{ secrets.HOSTD_E2E_TEST_API_URL }}
HOSTD_E2E_TEST_API_PASSWORD: ${{ secrets.HOSTD_E2E_TEST_API_PASSWORD }}
WALLETD_E2E_TEST_API_URL: ${{ secrets.WALLETD_E2E_TEST_API_URL }}
WALLETD_E2E_TEST_API_PASSWORD: ${{ secrets.WALLETD_E2E_TEST_API_PASSWORD }}
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: playwright-report
path: |
apps/renterd-e2e/output/
apps/hostd-e2e/output/
apps/walletd-e2e/output/
retention-days: 3
test-go:
# Run matrix since Go modules are used across all platforms
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
module: [./renterd, ./hostd, ./walletd]
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
steps:
- name: Checkout all commits
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git
uses: ./.github/actions/setup-git
# Only Go setup is necessary for running Go tests
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go_version: 1.21.7
- name: Lint Go
uses: golangci/golangci-lint-action@v4
with:
working-directory: ${{ matrix.module }}
skip-cache: true
- name: Test Go
uses: n8maninger/action-golang-test@v2
with:
args: '-race'
package: ${{ matrix.module }}/...