Unskipping tea tests and adding protection around possible nil models #17554
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------ | |
# Copyright 2023 The Radius Authors. | |
# | |
# 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 | |
# | |
# http://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: Check code is up-to-date | |
on: | |
pull_request: | |
branches: | |
- main | |
- release/* | |
concurrency: | |
# Cancel the previously triggered build for only PR build. | |
group: lint-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
linter_check: | |
name: Lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
GOVER: "1.22.2" | |
GOPROXY: https://proxy.golang.org | |
HELM_CHARTS_DIR: deploy/Chart | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ env.GOVER }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
- name: Install TypeSpec compiler | |
run: | | |
pushd typespec | |
npm ci | |
popd | |
- name: Install autorest | |
run: npm install -g [email protected] | |
- name: Install oav | |
run: npm install -g [email protected] | |
- name: Install mockgen | |
run: go install go.uber.org/mock/[email protected] | |
- name: Install controller-gen | |
run: go install sigs.k8s.io/controller-tools/cmd/[email protected] | |
- name: Install helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: "v3.11.1" | |
- name: Run Helm linter | |
run: | | |
helm lint ${{ env.HELM_CHARTS_DIR }} | |
- name: Run TypeSpec format check | |
run: | | |
pushd typespec | |
npx tsp format --check "**/*.tsp" | |
popd | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: "v1.61.0" | |
args: --timeout=10m | |
skip-cache: true | |
install-mode: "binary" | |
- name: Run make generate | |
run: make generate | |
- name: Check if generated code is up to date | |
continue-on-error: true | |
id: gitdiff | |
run: | | |
git diff --exit-code | |
- name: Check failures | |
if: steps.gitdiff.outcome != 'success' | |
run: | | |
echo "Generated code is not up to date, run 'make generate' to update generated code." | |
exit 1 | |
format-check: | |
name: Format check with Prettier | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
- name: Run `make format-check` | |
id: format-check | |
run: | | |
make format-check | |
- name: Check for formatting failures | |
if: steps.format-check.outcome == 'failure' | |
run: | | |
echo "Format check failed. Please fix the formatting issues. You can run 'make format-write' to update the code." | |
exit 1 |