mirror of
https://github.com/k3s-io/k3s.git
synced 2026-04-06 09:55:01 -04:00
87 lines
2.3 KiB
YAML
87 lines
2.3 KiB
YAML
name: Validate
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "channel.yaml"
|
|
- "install.sh"
|
|
- "tests/**"
|
|
- "!tests/e2e**"
|
|
- "!tests/docker**"
|
|
- ".github/**"
|
|
- "!.github/actions/**"
|
|
- "!.github/workflows/validate.yaml"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
validate:
|
|
name: Validate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Remove Unnecessary Tools
|
|
working-directory: /
|
|
run: |
|
|
sudo rm -rf \
|
|
/home/linuxbrew \
|
|
/home/packer \
|
|
/opt/az \
|
|
/opt/microsoft \
|
|
/usr/lib/firefox \
|
|
/usr/lib/google-cloud-sdk \
|
|
/usr/local/julia* \
|
|
/usr/local/share/boost \
|
|
/usr/local/share/chromium \
|
|
/usr/local/share/powershell \
|
|
/usr/share/az* \
|
|
/usr/share/dotnet \
|
|
/usr/share/miniconda \
|
|
/usr/share/swift
|
|
df -khl
|
|
|
|
- name: Set Commit Count
|
|
run: |
|
|
echo "GITHUB_CHECKOUT_FETCH_DEPTH=$( expr 1 + ${{ github.event.pull_request.commits }} )" >> "$GITHUB_ENV"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: ${{ env.GITHUB_CHECKOUT_FETCH_DEPTH }}
|
|
|
|
- name: Set Go Version
|
|
run: |
|
|
source ./scripts/version.sh
|
|
echo "GOTOOLCHAIN=${VERSION_GOLANG/go}" >> "$GITHUB_ENV"
|
|
|
|
- name: Setup Go
|
|
uses: ./.github/actions/setup-go
|
|
with:
|
|
go-version: "${{ env.GOTOOLCHAIN }}"
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: v2.7
|
|
args: "--new-from-merge-base ${{ github.event.pull_request.base.sha }}"
|
|
skip-save-cache: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
- name: Lint (windows)
|
|
uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: v2.7
|
|
args: "--new-from-merge-base ${{ github.event.pull_request.base.sha }} ./pkg/... ./cmd/..."
|
|
skip-save-cache: ${{ github.ref != 'refs/heads/main' }}
|
|
env:
|
|
GOOS: "windows"
|
|
|
|
- name: Validate
|
|
run: ./scripts/validate
|
|
env:
|
|
SKIP_LINT: "true"
|
|
|
|
- name: Validate (windows)
|
|
run: ./scripts/validate
|
|
env:
|
|
SKIP_LINT: "true"
|
|
GOOS: "windows"
|