-
Notifications
You must be signed in to change notification settings - Fork 108
72 lines (67 loc) · 1.74 KB
/
test.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
name: Test
on:
push:
branches:
- main
pull_request: {}
permissions:
contents: read
jobs:
syntax_check:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: 'Install dependencies'
run: 'gem install rbs'
- name: 'Test syntax check'
run: 'rbs parse gems/**/*.rbs'
test_on_changed_gems:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run bin/setup
run: bin/setup
- name: Get changed gems
id: changes
run: |
END_MARKER="$(uuidgen)"
echo "gems<<${END_MARKER}" >> "$GITHUB_OUTPUT"
gh pr diff '${{ github.event.number }}' --name-only | \
grep '^gems/' | \
awk -F / '{printf "%s/%s/%s\n", $1, $2, $3}' | \
sort -u | \
tee -a "$GITHUB_OUTPUT"
echo "${END_MARKER}" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run test on changed gems
if: steps.changes.outputs.gems
run: |
cat <<EOD | xargs bin/test --verbose
${{ steps.changes.outputs.gems }}
EOD
test_all_gems:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run bin/setup
run: bin/setup
- name: Run test on all gems
run: bin/test --all --verbose