feat: Update sdutil output #20
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 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 | |
# | |
# 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: tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: read # Needed to check out the repo. | |
jobs: | |
# Unit tests for Go code | |
###################################### | |
unit-tests-matrix: | |
name: unit tests | |
strategy: | |
matrix: | |
go-version: | |
- "1.23" | |
- "1.22" | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
if: ${{ always() }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: unit tests | |
run: | | |
make go-test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
fail_ci_if_error: true | |
# NOTE: needed for protected branch checks. | |
unit-tests: | |
runs-on: ubuntu-latest | |
needs: [unit-tests-matrix] | |
if: ${{ always() }} | |
env: | |
UNIT_TESTS_RESULT: ${{ needs.unit-tests-matrix.result }} | |
steps: | |
- run: | | |
[ "${UNIT_TESTS_RESULT}" == "success" ] | |
# autogen for license headers | |
############################### | |
autogen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
repository: mbrukman/autogen | |
ref: 9026b78e17573b5dda4bff79033c352443551dc5 | |
path: autogen | |
- run: | | |
echo "${GITHUB_WORKSPACE}/autogen" >> "${GITHUB_PATH}" | |
- run: make autogen | |
- name: check diff | |
run: | | |
set -euo pipefail | |
if [ "$(GIT_PAGER="cat" git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then | |
echo "Detected license header changes. See status below:" | |
GIT_PAGER="cat" git diff | |
exit 1 | |
fi | |
# linters | |
############################### | |
actionlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: actionlint | |
env: | |
SHELLCHECK_VERSION: "0.10.0" | |
SHELLCHECK_CHECKSUM: "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87" | |
ACTIONLINT_VERSION: "1.7.3" | |
ACTIONLINT_CHECKSUM: "37252b4d440b56374b0fc1726e05fd7452d30d6d774f6e9b52e65bb64475f9db" | |
run: | | |
set -euo pipefail | |
# Install shellcheck | |
curl -sSLo shellcheck.tar.gz "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | |
echo "shellcheck checksum is $(sha256sum shellcheck.tar.gz | awk '{ print $1 }')" | |
echo "expected checksum is $SHELLCHECK_CHECKSUM" | |
echo "$SHELLCHECK_CHECKSUM shellcheck.tar.gz" | sha256sum --strict --check --status || exit 1 | |
tar xf shellcheck.tar.gz | |
mv "shellcheck-v${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin | |
# Install actionlint | |
curl -sSLo actionlint.tar.gz "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" | |
echo "actionlint checksum is $(sha256sum actionlint.tar.gz | awk '{ print $1 }')" | |
echo "expected checksum is $ACTIONLINT_CHECKSUM" | |
echo "$ACTIONLINT_CHECKSUM actionlint.tar.gz" | sha256sum --strict --check --status || exit 1 | |
tar xf actionlint.tar.gz | |
mv ./actionlint /usr/local/bin | |
make actionlint | |
markdownlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version-file: "package.json" | |
- run: make markdownlint | |
yamllint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- run: | | |
set -euo pipefail | |
# Install yamllint | |
pip install -r requirements.txt --require-hashes | |
# Run yamllint | |
make yamllint | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version-file: "go.mod" | |
- env: | |
GOLANGCI_LINT_VERSION: "1.61.0" | |
GOLANGCI_LINT_CHECKSUM: "77cb0af99379d9a21d5dc8c38364d060e864a01bd2f3e30b5e8cc550c3a54111" | |
run: | | |
set -euo pipefail | |
#Install golangci-lint | |
curl -sSLo golangci-lint.tar.gz "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" | |
echo "golangci-lint checksum is $(sha256sum golangci-lint.tar.gz | awk '{ print $1 }')" | |
echo "expected checksum is $GOLANGCI_LINT_CHECKSUM" | |
echo "$GOLANGCI_LINT_CHECKSUM golangci-lint.tar.gz" | sha256sum --strict --check --status || exit 1 | |
tar xf golangci-lint.tar.gz | |
mv "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint" /usr/local/bin | |
# Run golangci-lint | |
make golangci-lint |