-
Notifications
You must be signed in to change notification settings - Fork 2
100 lines (82 loc) · 2.23 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
name: ci
on:
push:
jobs:
qa:
runs-on: ubuntu-latest
services:
postgres:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
image: postgres:13.3-alpine
ports: ["5432:5432"]
redis:
image: redis:6.2.5-alpine
ports: [ "6379:6379" ]
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
steps:
- name: Increase max fs watches
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Cache Ruby Dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-v1-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-v1
- name: Setup
run: bin/setup
- name: Run linters
run: |
bin/qa
- name: Test assets compilation
run: RAILS_ENV=test bin/rails assets:precompile
- name: Run unit tests
run: bin/rails test
- name: Run E2E tests
run: bin/rails test:system
- name: Publish code coverage
uses: paambaati/codeclimate-action@v5.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
- name: Upload failed tests screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: system-tests-screenshots
path: tmp/screenshots/**/*.png
- name: Upload Rails logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: log/**/*.log
deploy:
needs: qa
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: deploy
name: Deploy to dokku
continue-on-error: true
uses: idoberko2/dokku-deploy-github-action@v1
with:
ssh-private-key: ${{ secrets.DOKKU_SSH_KEY }}
dokku-host: ${{ secrets.DOKKU_HOST }}
app-name: 'malheatmap'
git-push-flags: --force
remote-branch: main