-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (120 loc) · 3.22 KB
/
build.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
---
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: pages_test
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
name: Build
on:
push:
branches:
- main
- develop
pull_request:
jobs:
rubocop-test:
name: Rubocop
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.3
- name: Check code
run: bundle exec rubocop
eslint-test:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm lint
typescript-test:
name: Typescript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm tsc --noEmit
rspec-test:
name: RSpec
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
ruby: ["3.2", "3.3"]
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
- name: Install system dependencies
run: sudo apt-get install -y libpq-dev libvips42
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Create database
env:
RAILS_ENV: test
run: |
bundle exec rake db:migrate
- name: Reload database config
run: psql -c "SELECT pg_reload_conf()"
- name: Run tests
run: bundle exec rspec
- name: Send results to Code Climate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: ls
notify-slack:
name: Slack notification
if: "always() && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[ci skip]')"
needs:
- rubocop-test
- eslint-test
- typescript-test
- rspec-test
runs-on: ubuntu-latest
steps:
- name: Prepare message
id: message
uses: anyone-oslo/github-action-notify-slack@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.run_id }}
run-number: ${{ github.run_number }}
- name: Send to Slack
if: success()
run: |
curl -X POST ${{ secrets.SLACK_WEBHOOK_URL}} -H "Content-type: application/json" --data '${{ steps.message.outputs.message }}'