Repository navigation
125 lines (125 loc) · 4.85 KB
/
Copy pathruby.yaml
File metadata and controls
125 lines (125 loc) · 4.85 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
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Ruby
on: [push, pull_request, merge_group]
permissions:
contents: read
jobs:
build-and-test:
name: ${{ matrix.job-name }}
runs-on: ubuntu-24.04
# Presubmit jobs must complete within 5 minutes.
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
include:
- job-name: 'Unit Tests'
task: 'unit-test'
- job-name: 'Smoke Test'
task: 'smoke-test'
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-librarian
- name: Checkout google-cloud-ruby (Sparse)
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: googleapis/google-cloud-ruby
path: google-cloud-ruby
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
librarian.yaml
# Note: If changing the target of the smoke test below, update this sparse checkout rule.
google-cloud-asset-v1/
- uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
with:
ruby-version: '4.0'
bundler-cache: true
- name: Cache Librarian Tools
id: cache-tools
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cache/librarian
key: librarian-ruby-tools-v2-${{ runner.os }}-${{ hashFiles('internal/config/**/*.go') }}-${{ hashFiles('google-cloud-ruby/librarian.yaml') }}
- name: Add Ruby tools to PATH
run: echo "$HOME/.cache/librarian/bin/ruby_tools/bin" >> $GITHUB_PATH
- name: Run librarian install
if: steps.cache-tools.outputs.cache-hit != 'true'
working-directory: google-cloud-ruby
run: |
librarian install
- name: Verify tools
run: |
gem --version
- name: Run internal/librarian/ruby tests and check coverage
if: matrix.task == 'unit-test'
run: go run ./tool/cmd/coverage ./internal/librarian/ruby
- name: Generate a single library (smoke test)
if: matrix.task == 'smoke-test'
working-directory: google-cloud-ruby
run: librarian generate google-cloud-asset-v1
integration-test:
name: Integration test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-librarian
- name: Checkout google-cloud-ruby (Full)
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: googleapis/google-cloud-ruby
path: google-cloud-ruby
persist-credentials: false
- uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0
with:
ruby-version: '4.0'
bundler-cache: true
- name: Cache Librarian Tools
id: cache-tools
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cache/librarian
key: librarian-ruby-tools-v2-${{ runner.os }}-${{ hashFiles('internal/config/**/*.go') }}-${{ hashFiles('google-cloud-ruby/librarian.yaml') }}
- name: Add Ruby tools to PATH
run: echo "$HOME/.cache/librarian/bin/ruby_tools/bin" >> $GITHUB_PATH
- name: Run librarian install
if: steps.cache-tools.outputs.cache-hit != 'true'
working-directory: google-cloud-ruby
run: |
librarian install
- name: Verify tools
run: |
gem --version
- name: Run librarian generate all (integration test)
working-directory: google-cloud-ruby
run: librarian generate --all
create-issue-on-failure:
needs: [build-and-test, integration-test]
permissions:
contents: read
issues: write
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/create-issue-on-failure.yaml
with:
language: Ruby
repository: google-cloud-ruby