-
Notifications
You must be signed in to change notification settings - Fork 24
150 lines (132 loc) · 4.69 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
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
149
150
name: Test generator
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
container: gcr.io/gapic-images/googleapis:20230531
# Dockerfile for this image: https://github.com/googleapis/googleapis-discovery/blob/master/Dockerfile
# If you update its version, please also update it below in
# 'Cache Bazel files' - unfortunately it cannot accept variables at this
# time.
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Cache Bazel files
id: cache-bazel
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-googleapis-20220711-${{ secrets.CACHE_VERSION }}
- name: Cache not found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Cache found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."
- name: Run bazel build
run: bazel build '//...'
- name: Run bazel test
run: bazel test --test_output=errors //...
- name: Verify error conformance
run: |
curl -sSL https://github.com/googleapis/gapic-config-validator/releases/download/v0.6.0/gapic-config-validator-0.6.0-linux-amd64.tar.gz > config-validator.tar.gz
tar xzf config-validator.tar.gz --no-same-owner
chmod +x gapic-error-conformance
chmod +x bazel-bin/protoc_plugin.sh
./gapic-error-conformance -plugin="bazel-bin/protoc_plugin.sh"
- name: Prepare baseline artifacts
run: |
mkdir -p ~/artifacts
cp bazel-testlogs/unit_tests/test.outputs/outputs.zip ~/artifacts/
bazel run -- @pnpm//:pnpm --dir $PWD install
tar cfz ~/artifacts/node_modules.tar.gz node_modules
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ~/artifacts
lib-tests:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
lib-name: [showcase, kms, translate, monitoring, dlp, texttospeech, showcase-legacy, compute, logging]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: ~/artifacts
- name: Prepare ${{ matrix.lib-name }} library to test
run: |
unzip ~/artifacts/outputs.zip '.test-out-${{ matrix.lib-name }}/*' -d library
mv library/.test-out-${{ matrix.lib-name }} library/${{ matrix.lib-name }}
- name: Test ${{ matrix.lib-name }} library
run: |
cd library/${{ matrix.lib-name }}
pwd
npm install
npm test
npm run fix
# Second compile to make sure "gts fix" did not break the code, it happens!
rm -rf build
npm run compile
npm run system-test
npm run docs
lib-tests-esm:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
lib-name: [showcase, kms, translate, monitoring, dlp, texttospeech, showcase-legacy, compute, logging]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: ~/artifacts
- name: Prepare ${{ matrix.lib-name }}-esm library to test
run: |
unzip ~/artifacts/outputs.zip '.test-out-${{ matrix.lib-name }}-esm/*' -d library
mv library/.test-out-${{ matrix.lib-name }}-esm library/${{ matrix.lib-name }}-esm
- name: Test ${{ matrix.lib-name }} library
run: |
cd library/${{ matrix.lib-name }}-esm
pwd
npm install
npm test
npm run fix
# Second compile to make sure "gts fix" did not break the code, it happens!
rm -rf build
npm run compile
npm run system-test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@v4
with:
node-version: 14
- run: npm install
- run: npm run lint