-
Notifications
You must be signed in to change notification settings - Fork 25
97 lines (83 loc) · 3.18 KB
/
ci_rails.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
# GitHub Actions Continuous Integration of MO Rails Code
# Runs the tests and publishes the results to Coveralls
name: Continuous Integration
on:
push:
# branches: main
branches:
- "*" # Run on pushes on all branches
pull_request:
branches: main
jobs:
test:
runs-on: ubuntu-22.04
steps:
# check-out repo under $GITHUB_WORKSPACE, so that workflow can access it.
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v4
# https://github.com/ruby/setup-ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs bundle install, caches gems
- name: Install additional tools
run: sudo apt-get install exiftool
- name: Install Chrome/Chromium
run: sudo apt-get install chromium-browser
# MySQL is installed but does not run by default
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql
- name: Start mySQL
run: sudo systemctl start mysql.service
# https://github.com/trilogy-libraries/activerecord-trilogy-adapter/issues/64
# Issue in the trilogy gem where it cannot support `caching_sha2_password`
# https://github.com/trilogy-libraries/trilogy/issues/26
# For now need to ensure user is IDENTIFIED WITH `mysql_native_password`
# (change is in db/initialize.sql)
- name: Create and configure db
run: |
mysql -u root -proot < db/initialize.sql
cp db/vagrant/database.yml config
- name: Create test image directories
run: |
for dir in images test_images;
do
for subdir in thumb 320 640 960 1280 orig;
do
mkdir -p public/$dir/$subdir
done
done
- name: install exifautotran
run: |
sudo cp script/exifautotran /usr/local/bin/exifautotran
sudo chmod 755 /usr/local/bin/exifautotran
- name: Load fixtures
run: |
bundle exec rake db:schema:load
bundle exec rake db:fixtures:load
- name: Update translation files
run: bundle exec rake lang:update
# And finally we can run the test suite
- name: Run tests
env:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: bundle exec rails test:all
# https://github.com/marketplace/actions/coveralls-github-action
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov/lcov.info
# https://github.com/devmasx/brakeman-linter-action
# Temporarily disable brakeman in CI because it causes an error
# See https://github.com/MushroomObserver/mushroom-observer/issues/1514
# Instead use brakeman's plugin. See .codeclimate.yml
# JDC 2023-06-05
# - name: brakeman report
# run: |
# bundle exec brakeman -f json > brakeman.json || exit 0
# - name: Brakeman
# uses: devmasx/brakeman-linter-action@v1.0.0
# env:
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# REPORT_PATH: brakeman.json