-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (95 loc) · 2.99 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
name: Continuous integration
on:
push:
branches:
- main
pull_request: {}
jobs:
minitest:
name: minitest
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost/${{ github.event.repository.name }}_test
RAILS_ENV: test
services:
postgres:
image: postgres:14.8
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: install node
uses: actions/setup-node@v3
- name: Database setup
run: bundle exec rake db:create db:schema:load
- name: Install Bower
run: npm install -g bower
- name: Compile assets
run: bundle exec rake assets:precompile
- name: Run tests
run: TERM=xterm-color bundle exec rake test
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
check_name: "Minitest Report"
report_paths: "test/reports/TEST-*.xml"
- name: Archive HTML test reports
uses: actions/upload-artifact@v3
if: always()
with:
name: test-reports
path: test/html_reports
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Read .ruby-version
id: ruby-version
run: echo "ruby-version=$(cat .ruby-version)" >> $GITHUB_OUTPUT
- name: Build (and push to registry, if on main)
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
platforms: linux/amd64
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
build-args: |
RUBY_VERSION=${{ steps.ruby-version.outputs.ruby-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
update-release-draft:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
needs:
- docker-build
- minitest
outputs:
name: ${{ steps.release-drafter.outputs.name }}
html_url: ${{ steps.release-drafter.outputs.html_url }}
steps:
- uses: release-drafter/release-drafter@v5
id: release-drafter
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}