-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (125 loc) · 4.32 KB
/
ci.yml
File metadata and controls
126 lines (125 loc) · 4.32 KB
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
126
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Lint & Tests"
permissions:
contents: read
pull-requests: write
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
lint:
# This is Ubuntu 24.04 currently: https://github.com/actions/runner-images/blob/ubuntu24/20250907.24/images/ubuntu/Ubuntu2404-Readme.md
# Building an own image is not worth it, pulling it in gh actions
# is about as slow as installing the dependencies and it blocks using cached gems
runs-on: ubuntu-latest
#container:
# image: ghcr.io/mapforge-org/mapforge-ci-runner:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update package lists
run: sudo apt-get update
- name: Disable mandb updates
run: |
sudo mv /usr/bin/mandb /usr/bin/mandb.bak
echo -e '#!/bin/sh\nexit 0' | sudo tee /usr/bin/mandb > /dev/null
sudo chmod +x /usr/bin/mandb
- name: Install dependencies
run: sudo apt-get install --no-install-recommends -y libproj-dev libimlib2-dev
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
# caches by Gemfile.lock checksum
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install npm dependencies
run: npm ci --ignore-scripts
- name: Security audit dependencies
run: bin/bundler-audit --update
- name: Security audit application code
run: bin/brakeman -q -w2
- name: Lint Ruby files
run: bin/rubocop --parallel
- name: Lint Javascript
run: npm run lint:js
- name: Lint CSS
run: npm run lint:css
test:
runs-on: ubuntu-latest
#container:
# image: ghcr.io/mapforge-org/mapforge-ci-runner:latest
services:
mongodb:
image: mongo:8.2
ports:
- 27017:27017
# credentials are only needed when not running on ubuntu-latest VM
# credentials:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_TOKEN }}
env:
RAILS_ENV: test
PARALLEL_TEST_PROCESSORS: ${{ vars.PARALLEL_TEST_PROCESSORS }}
COVERAGE: true
SE_AVOID_STATS: true # skip Selenium stats
SE_DISABLE_REMOTE_MANAGER: true # skip Selenium plausible telemetry
# MONGO_URL is only needed when not running on ubuntu-latest VM
# MONGO_URL: "mongodb:27017"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update package lists
run: sudo apt-get update
- name: Disable mandb updates
run: |
sudo mv /usr/bin/mandb /usr/bin/mandb.bak
echo -e '#!/bin/sh\nexit 0' | sudo tee /usr/bin/mandb > /dev/null
sudo chmod +x /usr/bin/mandb
- name: Install dependencies
# run: sudo apt-get install -y ruby-dev build-essential git libvips pkg-config libproj-dev proj-bin libimlib2 libimlib2-dev imagemagick
run: sudo apt-get install --no-install-recommends -y libproj-dev proj-bin libimlib2 libimlib2-dev imagemagick
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
# caches by Gemfile.lock checksum
bundler-cache: true
- name: Run tests
id: rspec
#run: |
# bin/rspec --pattern "spec/**/*_spec.rb,engines/**/*_spec.rb"
run: |
bin/parallel_rspec spec engines
shell: bash
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ./tmp/capybara
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: rails-logs
path: ./log/test.log
- name: Upload coverage
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage
path: ./coverage
# - name: Coveralls
# uses: coverallsapp/github-action@v2
# with:
# fail-on-error: false