-
-
Notifications
You must be signed in to change notification settings - Fork 51
117 lines (100 loc) · 2.55 KB
/
ci.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
name: "CI"
on:
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_call:
workflow_dispatch:
jobs:
test-unit:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.6.1"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build TypeScript
run: yarn run build
- name: Run tests
run: |
yarn run lint
yarn run test:unit
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
test-e2e:
name: E2E Test
runs-on: ubuntu-latest
env:
DB_USER: mastodon
DB_NAME: mastodon
DB_PASS: password
MASTODON_CONTAINER: mastodon
services:
db:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_PASSWORD: ${{ env.DB_PASS }}
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd "pg_isready -U postgres"
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20.6.1"
cache: yarn
- name: Setup Mastodon
run: >-
docker run
-i
--rm
--env-file ./.github/.env.test
docker.io/neetshin/mastodon-dev:latest
bash -c "RAILS_ENV=development bundle exec rails db:setup"
- name: Run Mastodon
run: >-
docker run
-d
-p 3000:3000
-p 4000:4000
--name ${{ env.MASTODON_CONTAINER }}
-e DEEPL_PLAN=${{ secrets.DEEPL_PLAN }}
-e DEEPL_API_KEY=${{ secrets.DEEPL_API_KEY }}
--env-file ./.github/.env.test
docker.io/neetshin/mastodon-dev:latest
bash -c "foreman start"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn run test:e2e --max-workers=2
- name: Codecov
uses: codecov/codecov-action@v3
with:
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}