forked from googleapis/repo-automation-bots
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (95 loc) · 3.3 KB
/
ci.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
on:
push:
branches:
- main
pull_request:
name: ci
jobs:
changeFinder:
runs-on: ubuntu-latest
outputs:
nodePaths: ${{ steps.interrogate.outputs.nodePaths }}
goPaths: ${{ steps.interrogate.outputs.goPaths }}
bashPaths: ${{ steps.interrogate.outputs.bashPaths }}
requiredJobs: ${{ steps.interrogate.outputs.requiredJobs }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
fetch-depth: 0
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: 18
- id: interrogate
run: node ./.github/workflows/interrogate.js
env:
GITHUB_BASE_REF: ${{github.base_ref}}
test:
runs-on: ubuntu-latest
needs: changeFinder
strategy:
fail-fast: false
matrix:
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ (endsWith(matrix.package, '-utils') || matrix.package == 'canary-bot' || matrix.package == 'datastore-lock' || matrix.package == 'object-selector' || matrix.package == 'release-please' ) && 18 || 14 }}
- run: echo ./packages/${{ matrix.package }}
- run: cd ./packages/${{ matrix.package }}
- run: npm ci
working-directory: ./packages/${{ matrix.package }}
- run: pwd
- run: npm test
working-directory: ./packages/${{ matrix.package }}
- run: npm run lint
working-directory: ./packages/${{ matrix.package }}
go-test:
runs-on: ubuntu-latest
needs: changeFinder
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.changeFinder.outputs.goPaths)}}
steps:
- name: Install Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
with:
go-version: '^1.16'
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: goimports
run: |
test -z "$($(go env GOPATH)/bin/goimports -l .)"
working-directory: ./${{ matrix.module }}
- name: Instructions to fix goimports (if necessary)
run: echo Run goimports -w .
if: failure()
- run: go test ./...
working-directory: ./${{ matrix.module }}
bash-test:
runs-on: ubuntu-latest
needs: changeFinder
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.changeFinder.outputs.bashPaths)}}
steps:
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: bashtest
run: |
./test.sh
working-directory: ./${{ matrix.module }}
finale:
runs-on: ubuntu-latest
needs: changeFinder
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: 18
- run: npm install
- run: node ./.github/workflows/finale.js '${{needs.changeFinder.outputs.requiredJobs}}' ${{secrets.GITHUB_TOKEN}}