-
Notifications
You must be signed in to change notification settings - Fork 1.2k
157 lines (129 loc) · 6.31 KB
/
e2e.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# this workflow will run on every pr to make sure the project is following the guidelines
# after labeler, run other actions with strict permissions
name: E2E Tests
on:
pull_request:
branches:
- "*"
paths:
- "cli/**/*"
merge_group:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build-t3-app:
runs-on: ubuntu-latest
# if: |
# contains(github.event.pull_request.labels.*.name, '📌 area: cli') ||
# contains(github.event.pull_request.labels.*.name, '📌 area: t3-app')
strategy:
matrix:
trpc: ["true", "false"]
tailwind: ["true", "false"]
nextAuth: ["true", "false"]
prisma: ["true", "false"]
appRouter: ["true", "false"]
drizzle: ["true", "false"]
dbType: ["planetscale", "sqlite", "mysql", "postgres"]
name: "Build and Start T3 App ${{ matrix.trpc }}-${{ matrix.tailwind }}-${{ matrix.nextAuth }}-${{ matrix.prisma }}-${{ matrix.drizzle}}-${{ matrix.appRouter }}-${{ matrix.dbType }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check valid matrix
id: matrix-valid
run: |
echo "continue=${{ (matrix.prisma == 'false' || matrix.drizzle == 'false') && (matrix.drizzle == 'true' || matrix.prisma == 'true' || matrix.dbType == 'sqlite') }}" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
- run: pnpm turbo --filter=create-t3-app build
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
# has to be scaffolded outside the CLI project so that no lint/tsconfig are leaking
# through. this way it ensures that it is the app's configs that are being used
# FIXME: this is a bit hacky, would rather have --packages=trpc,tailwind,... but not sure how to setup the matrix for that
- run: cd cli && pnpm start ../../ci-${{ matrix.trpc }}-${{ matrix.tailwind }}-${{ matrix.nextAuth }}-${{ matrix.prisma }}-${{ matrix.drizzle}}-${{ matrix.appRouter }}-${{ matrix.dbType }} --noGit --CI --trpc=${{ matrix.trpc }} --tailwind=${{ matrix.tailwind }} --nextAuth=${{ matrix.nextAuth }} --prisma=${{ matrix.prisma }} --drizzle=${{ matrix.drizzle }} --appRouter=${{ matrix.appRouter }} --dbProvider=${{ matrix.dbType }} --eslint
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
# can't use default mysql string cause t3-env blocks that
- run: cd ../ci-${{ matrix.trpc }}-${{ matrix.tailwind }}-${{ matrix.nextAuth }}-${{ matrix.prisma }}-${{ matrix.drizzle}}-${{ matrix.appRouter }}-${{ matrix.dbType }} && pnpm build
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
env:
AUTH_SECRET: foo
AUTH_DISCORD_ID: bar
AUTH_DISCORD_SECRET: baz
SKIP_ENV_VALIDATION: true
check-well-formatted:
runs-on: ubuntu-latest
strategy:
matrix:
eslint: ["true", "false"]
biome: ["true", "false"]
name: "Build and Start T3 App"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check valid matrix
id: matrix-valid
run: |
echo "continue=${{ (matrix.eslint == 'false' || matrix.biome == 'false') && (matrix.biome == 'true' || matrix.eslint == 'true') }}" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
- run: pnpm turbo --filter=create-t3-app build
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
- run: cd cli && pnpm start ../../ci-format-${{ matrix.eslint }}-${{ matrix.biome }} --noGit --CI --trpc --tailwind --nextAuth --drizzle --appRouter --dbProvider=postgres --eslint=${{ matrix.eslint }} --biome=${{ matrix.biome }}
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
- run: cd ../ci-format-${{ matrix.eslint }}-${{ matrix.biome }} && pnpm build
if: ${{ steps.matrix-valid.outputs.continue == 'true' }}
env:
AUTH_SECRET: foo
AUTH_DISCORD_ID: bar
AUTH_DISCORD_SECRET: baz
SKIP_ENV_VALIDATION: true
# Run biome check
- run: cd ../ci-format-${{ matrix.eslint }}-${{ matrix.biome }} && pnpm check
if: ${{ steps.matrix-valid.outputs.continue == 'true' && matrix.biome == 'true' }}
# Check linting and formatting with eslint and prettier
- run: cd ../ci-format-${{ matrix.eslint }}-${{ matrix.biome }} && pnpm lint && pnpm format:check
if: ${{ steps.matrix-valid.outputs.continue == 'true' && matrix.eslint == 'true' }}
env:
AUTH_SECRET: foo
AUTH_DISCORD_ID: bar
AUTH_DISCORD_SECRET: baz
SKIP_ENV_VALIDATION: true
build-t3-app-with-bun:
runs-on: ubuntu-latest
name: "Build and Start T3 App with Bun"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# First install everything and build the CLI with Node
- uses: ./.github/actions/setup
- run: pnpm turbo --filter=create-t3-app build
# Then, run the CLI and build the generated app with Bun
# Let's just build a full app with Bun, we don't need the matrix here
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: cd cli && bun run dist/index.js ../../ci-bun --default
- name: We should have a Bun lockfile
run: |
if [ ! -f "../ci-bun/bun.lockb" ]; then
echo "Bun lockfile not found"
exit 1
fi
# FIXME: This doesn't actually run the build script using bun, since Next.js doesn't support it yet.
# But you should still be able to use `bun` as a package manager for any Next.js app.
# If/When Next.js supports it, we should be able to run `bun --bun run build` here to override any Node binaries.
# See: https://bun.sh/docs/cli/bunx#shebangs
- run: cd ../ci-bun && bun run build
# - run: cd ../ci-bun && bun --bun run build
env:
AUTH_SECRET: foo
AUTH_DISCORD_ID: bar
AUTH_DISCORD_SECRET: baz
DATABASE_URL: mysql://root:root@localhost:3306/test # can't use url from example env cause we block that in t3-env