-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
103 lines (85 loc) · 2.86 KB
/
action.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
name: 🌲 Redwood build, lint, diagnostics, and tests
description: Run CI on a Redwood Project
inputs:
node-version:
description: Node.js Version. Default is `20`.
default: 20
project-directory:
description: Path to project directory. Default is '.'.
default: '.'
yarn-cache:
description: Enable Yarn caching. Default is `true`.
default: true
run-lint:
description: Run lint. Default is `true`.
default: true
github-token:
description: GITHUB_TOKEN
default: '${{ github.token }}'
runs:
using: composite
steps:
- uses: actions/checkout@v4
- name: ⬢ Enable Corepack
run: corepack enable
shell: bash
working-directory: ${{ inputs.project-directory }}
- name: ⬢ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: 🐘 Set up Postgres
uses: CasperWA/postgresql-action@v1
with:
postgresql version: 14
postgresql db: test
postgresql user: test
postgresql password: password
- name: 📁 Get yarn cache directory
if: ${{ inputs.yarn-cache == 'true' }}
id: get-yarn-cache-directory
run: echo "CACHE_DIRECTORY=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash
working-directory: ${{ inputs.project-directory }}
- name: ♻️ Restore yarn cache
if: ${{ inputs.yarn-cache == 'true' }}
uses: actions/cache@v3
with:
path: ${{ steps.get-yarn-cache-directory.outputs.CACHE_DIRECTORY }}
key: yarn-cache-${{ runner.os }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-cache-${{ runner.os }}
- name: 🐈 Yarn install
run: yarn install --inline-builds
shell: bash
working-directory: ${{ inputs.project-directory }}
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
- name: ◭ Run migrate
run: yarn rw prisma migrate dev
shell: bash
working-directory: ${{ inputs.project-directory }}
env:
DATABASE_URL: postgresql://test:password@localhost:5432/test
- name: 🏗️ Run build
run: yarn rw build
shell: bash
working-directory: ${{ inputs.project-directory }}
env:
DATABASE_URL: postgresql://test:password@localhost:5432/test
- name: 🔎 Run lint
if: ${{ inputs.run-lint == 'true' }}
run: yarn rw lint
shell: bash
working-directory: ${{ inputs.project-directory }}
- name: 🔬 Run diagnostics
run: yarn rw check
shell: bash
working-directory: ${{ inputs.project-directory }}
- name: 🧪 Run tests
run: |
yarn rw test api --no-watch
yarn rw test web --no-watch
shell: bash
working-directory: ${{ inputs.project-directory }}
env:
TEST_DATABASE_URL: postgresql://test:password@localhost:5432/test