-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (132 loc) · 4.68 KB
/
Copy pathruby.yml
File metadata and controls
148 lines (132 loc) · 4.68 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Github Testing
on:
push:
branches: [master]
pull_request:
env:
BUNDLE_DEPLOYMENT: "1"
BUNDLE_WITHOUT: "development:staging:production"
jobs:
bundle_audit:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Verify gems match this PR lockfile
run: |
expected=$(sed 's/^ruby-//' .ruby-version | tr -d '[:space:]')
actual=$(ruby -e 'print RUBY_VERSION')
echo "Ruby from .ruby-version: $expected"
echo "Installed Ruby: $actual"
test "$expected" = "$actual"
bundle check
bundle list
- name: Bundle Audit Check
run: bundle exec bundle-audit check --update
brakeman:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Verify gems match this PR lockfile
run: |
expected=$(sed 's/^ruby-//' .ruby-version | tr -d '[:space:]')
actual=$(ruby -e 'print RUBY_VERSION')
echo "Ruby from .ruby-version: $expected"
echo "Installed Ruby: $actual"
test "$expected" = "$actual"
bundle check
bundle list
- name: Run Brakeman
run: bundle exec brakeman --quiet --skip-libs --exit-on-warn -i config/brakeman.ignore
test:
services:
postgres:
image: postgres:18
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: password
POSTGRES_USERNAME: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
ruby: ['3.4.9']
runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Hack sources.list
run: sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/sources.list
- name: Verify gems match this PR lockfile
run: |
expected=$(sed 's/^ruby-//' .ruby-version | tr -d '[:space:]')
actual=$(ruby -e 'print RUBY_VERSION')
echo "Ruby from .ruby-version: $expected"
echo "Installed Ruby: $actual"
test "$expected" = "$actual"
echo "Bundler: $(bundle -v)"
bundle env
bundle check
echo "Installed gems from this PR Gemfile.lock:"
bundle list
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --depth=1 origin "${{ github.base_ref }}"
echo "Gemfile.lock changes vs ${{ github.base_ref }}:"
git diff "origin/${{ github.base_ref }}" -- Gemfile.lock || true
fi
- name: Install wkhtmltopdf
run: sudo apt-get update && sudo apt-get install -y wkhtmltopdf
- name: Prepare config files
run: |
cp config/customization.yml.sample config/customization.yml
- name: Setup database
run: |
bundle exec rails db:create
bundle exec rails db:schema:load
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:password@localhost:5432/auction_center_test
- name: Run tests with coverage
run: bundle exec rails test
env:
RAILS_ENV: test
COVERAGE: true
DATABASE_URL: postgres://postgres:password@localhost:5432/auction_center_test
- name: Install qlty CLI
if: always()
run: |
curl -LSs https://qlty.sh | bash
echo "${HOME}/.qlty/bin" >> $GITHUB_PATH
- name: Upload coverage to Qlty
if: always()
env:
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
run: |
if [ -z "$QLTY_COVERAGE_TOKEN" ]; then
echo "Missing secret QLTY_COVERAGE_TOKEN; skipping Qlty upload."
exit 0
fi
if [ -f "coverage/.resultset.json" ]; then
qlty coverage publish --format=simplecov coverage/.resultset.json
elif [ -f "coverage/coverage.json" ]; then
qlty coverage publish --format=simplecov coverage/coverage.json
else
echo "No SimpleCov output found (expected coverage/.resultset.json or coverage/coverage.json); skipping Qlty upload."
exit 0
fi
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: coverage/
retention-days: 14