-
Notifications
You must be signed in to change notification settings - Fork 26
133 lines (132 loc) · 4.45 KB
/
sdk.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
# Copyright 2024 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: Rust SDK
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
os: ['macos-14', 'ubuntu-24.04', 'windows-2022']
rust-version: ['1.83']
include:
- os: 'ubuntu-24.04'
rust-version: '1.70'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: rustup toolchain install ${{ matrix.rust-version }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustc --version
- run: cargo test
coverage:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['1.83']
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ matrix.rust-version }}
cargo install cargo-tarpaulin
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustc --version
- run: cargo tarpaulin --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['1.83']
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: rustup toolchain install ${{ matrix.rust-version }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustc --version
- run: cargo clippy -- --deny warnings
- run: cargo fmt
- run: cargo doc
env:
RUSTDOCFLAGS: "-D warnings"
- run: git diff --exit-code
regenerate:
# Verifies the generated code has not been tampered with. Or maybe that the
# code requires no tampering.
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['1.83']
go-version: ['1.23']
steps:
- uses: actions/cache@v4
with:
path: |
~/.cache/sidekick
key: ${{ github.job }}-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- uses: actions/checkout@v4
- name: Setup Rust ${{ matrix.rust-version }}
run: rustup toolchain install ${{ matrix.rust-version }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustc --version
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: |
generator/go.sum
- name: Install protoc
run: |
set -e
curl -fSSL -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
cd /usr/local
sudo unzip -x /tmp/protoc.zip
protoc --version
- name: Regenerate all the code
working-directory: generator
run: go run ./cmd/sidekick refreshall -project-root ..
- run: cargo fmt
# If there is any difference between the generated code and the
# committed code that is an error. All the inputs should be pinned,
# including the generator version and the googleapis SHA.
- run: git diff --exit-code