-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (113 loc) · 3.69 KB
/
dev.yaml
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
name: Dev
on:
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
setup_pr:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
# Dependabot no longer have access to secrets unless we move to pull_request_target.
# Read more: https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
# Remove review_ready label when new commit push to PR
- name: Remove review_ready label
if: ${{ contains(github.event.pull_request.labels.*.name, 'review_ready') }}
uses: actions/github-script@v3
with:
# Fallback to github action token with limited access
# when DevOps token isn't available this happens on dependabot.
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'review_ready'
})
# Add wip label when new commit push to PR
- name: Add wip label
if: ${{ !contains(github.event.pull_request.labels.*.name, 'wip') }}
uses: actions/github-script@v3
with:
# Fallback to github action token with limited access
# when DevOps token isn't available this happens on dependabot.
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['wip']
})
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: false
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop --parallel
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check spelling with codespell
run: codespell --ignore-words=codespell.txt || exit 1
unit_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gemfile:
- rails_5.2_stable
- rails_6.0_stable
- rails_6.1_stable
- rails_7.0_stable
- rails_edge
ruby: ['2.7', '3.0', '3.1', '3.2']
exclude:
- ruby: '3.0'
gemfile: rails_5.2_stable
- ruby: '3.1'
gemfile: rails_5.2_stable
- ruby: '3.2'
gemfile: rails_5.2_stable
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Suppress git warnings
run: git config --global init.defaultBranch main
- name: Run RSpec
run: bundle exec rspec