Skip to content

Commit 8c8d159

Browse files
committed
Reuse common workflow jobs in publish workflow
1 parent 646bfd3 commit 8c8d159

File tree

1 file changed

+8
-114
lines changed

1 file changed

+8
-114
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -38,125 +38,19 @@ env:
3838

3939
jobs:
4040
typecheck:
41-
name: ʦ TypeScript
42-
runs-on: buildjet-4vcpu-ubuntu-2204
43-
steps:
44-
- name: ⬇️ Checkout repo
45-
uses: actions/checkout@v3
46-
with:
47-
fetch-depth: 0
41+
uses: ./.github/workflows/typecheck.yml
42+
secrets: inherit
4843

49-
- name: ⎔ Setup pnpm
50-
uses: pnpm/[email protected]
51-
with:
52-
version: 7.18
53-
54-
- name: ⎔ Setup node
55-
uses: buildjet/setup-node@v3
56-
with:
57-
node-version: 18
58-
cache: "pnpm"
59-
60-
- name: 📥 Download deps
61-
run: pnpm install --frozen-lockfile
62-
63-
- name: 📀 Generate Prisma Client
64-
run: pnpm run generate
65-
66-
- name: 🔎 Type check
67-
run: pnpm run typecheck --filter webapp
68-
69-
unitTests:
70-
name: Unit Tests
71-
runs-on: buildjet-4vcpu-ubuntu-2204
72-
steps:
73-
- name: ⬇️ Checkout repo
74-
uses: actions/checkout@v3
75-
with:
76-
fetch-depth: 0
77-
78-
- name: ⎔ Setup pnpm
79-
uses: pnpm/[email protected]
80-
with:
81-
version: 7.18
82-
83-
- name: ⎔ Setup node
84-
uses: buildjet/setup-node@v3
85-
with:
86-
node-version: 18
87-
cache: "pnpm"
88-
89-
- name: 📥 Download deps
90-
run: pnpm install --frozen-lockfile
91-
92-
- name: Run Unit Tests
93-
run: |
94-
pnpm run test
44+
units:
45+
uses: ./.github/workflows/unit-tests.yml
46+
secrets: inherit
9547

9648
e2e:
97-
name: e2e Tests
98-
runs-on: buildjet-4vcpu-ubuntu-2204
99-
steps:
100-
- name: 🐳 Login to Docker Hub
101-
uses: docker/login-action@v2
102-
with:
103-
username: ${{ secrets.DOCKERHUB_USERNAME }}
104-
password: ${{ secrets.DOCKERHUB_TOKEN }}
105-
106-
- name: ⬇️ Checkout repo
107-
uses: actions/checkout@v3
108-
with:
109-
fetch-depth: 0
110-
111-
- name: ⎔ Setup pnpm
112-
uses: pnpm/[email protected]
113-
with:
114-
version: 7.18
115-
116-
- name: ⎔ Setup node
117-
uses: buildjet/setup-node@v3
118-
with:
119-
node-version: 18
120-
cache: "pnpm"
121-
122-
- name: 📥 Download deps
123-
run: pnpm install --frozen-lockfile
124-
125-
- name: Install Playwright Browsers
126-
run: npx playwright install --with-deps
127-
128-
- name: Run Playwright tests
129-
run: |
130-
# Setup environment variables
131-
cp ./.env.example ./.env
132-
cp ./references/nextjs-test/.env.example ./references/nextjs-test/.env.local
133-
134-
# Build packages
135-
pnpm run build --filter @references/nextjs-test^...
136-
pnpm --filter @trigger.dev/database generate
137-
138-
# Move trigger-cli bin to correct place
139-
pnpm install --frozen-lockfile
140-
141-
# Execute tests
142-
pnpm run docker
143-
pnpm run db:migrate
144-
pnpm run db:seed
145-
pnpm run test:e2e
146-
147-
# Cleanup
148-
pnpm run docker:stop
149-
150-
- name: Upload Playwright report
151-
uses: actions/upload-artifact@v3
152-
if: always()
153-
with:
154-
name: playwright-report
155-
path: playwright-report/
156-
retention-days: 30
49+
uses: ./.github/workflows/e2e.yml
50+
secrets: inherit
15751

15852
publish:
159-
needs: [typecheck, unitTests, e2e]
53+
needs: [typecheck, units, e2e]
16054
runs-on: buildjet-4vcpu-ubuntu-2204
16155
outputs:
16256
version: ${{ steps.get_version.outputs.version }}

0 commit comments

Comments
 (0)