Merge pull request #473 from rancher-sandbox/dependabot/go_modules/gi… #1683
This file contains hidden or 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
name: CI | |
on: | |
workflow_call: | |
push: | |
pull_request: | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
with: | |
go-version-file: "go.mod" | |
- run: make test | |
- name: Upload unit-tests coverage to Codecov | |
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
with: | |
name: unit-tests | |
directory: coverage | |
flags: unit-tests | |
verbose: true | |
token: ${{ secrets.CODECOV_REPO_TOKEN }} | |
helm-unittest: | |
name: Helm unittest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- name: Install helm | |
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1 | |
- name: Install Helm-unittest | |
run: helm plugin install https://github.com/helm-unittest/helm-unittest | |
- run: make helm-unittest | |
golangci: | |
name: Golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
with: | |
go-version-file: "go.mod" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 | |
with: | |
version: v2.4.0 | |
commitlint: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
fetch-depth: 0 | |
- name: Discover latest version of commitlint | |
id: discover-commitlint-version | |
run: | | |
latest_version=$(curl -s https://api.github.com/repos/conventional-changelog/commitlint/releases/latest | jq -r '.tag_name') | |
echo "version=$latest_version" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache commitlint | |
id: cache-commitlint | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
with: | |
path: | | |
node_modules | |
package.json | |
package-lock.json | |
key: ${{ runner.os }}-commitlint-${{ steps.discover-commitlint-version.outputs.version }} | |
- name: Install commitlint | |
if: steps.cache-commitlint.outputs.cache-hit != 'true' | |
run: npm install -D @commitlint/cli @commitlint/config-conventional | |
- name: Print versions | |
run: | | |
git --version | |
node --version | |
npm --version | |
npx commitlint --version | |
- name: Validate PR commits with commitlint | |
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |