-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (107 loc) · 3.12 KB
/
lint-and-test.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
name: Lint and test
on: push
jobs:
zeitwerk:
name: Zeitwerk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
bundler-cache: true
- run: bin/rails zeitwerk:check
sorbet:
name: Sorbet
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
bundler-cache: true
- run: bin/rails sorbet:update
- name: Push RBI files or fail
run: |
if [ -n "$(git status --porcelain)" ]; then
if [ "$GITHUB_ACTOR" = "dependabot[bot]" ]; then
git config user.email 49699333+dependabot[bot]@users.noreply.github.com
git config user.name dependabot[bot]
git add .
git commit -m "Update RBI files"
git push
else
echo "Error! 未更新のRBIファイルがあるようです。bin/rails sorbet:update を実行して差分をコミットしてください。"
exit 1
fi
fi
- run: bin/srb tc
standard:
name: Standard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
bundler-cache: true
- run: bin/standardrb
rspec:
name: RSpec
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://postgres@localhost:5432/mewst_test
RAILS_ENV: test
services:
postgresql:
image: postgres:14.6
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_DB: mewst_test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
# Adding a health check via options
# https://github.community/t5/GitHub-Actions/Github-Actions-services-not-reachable/td-p/30050
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.11.1
- name: Install Yarn
run: |
npm install --global [email protected]
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
- run: chrome --version
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
bundler-cache: true
- name: Setup Database
run: |
bin/rails db:schema:load
- name: Precompile assets
# E2Eテストのために実行する
run: |
bin/rails assets:precompile
- run: bin/rspec
- name: Upload Capybara screenshot
uses: actions/upload-artifact@v4
if: failure()
with:
name: capybara-screenshots
path: '**/tmp/capybara/'