mirror of
https://github.com/rancher/cli.git
synced 2026-02-05 18:48:50 +01:00
* Bump Go to 1.25 * Bump golangci-lint * Explicitly set Go toolchain to be able to run unit-tests * Remove lint step from ci script
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: false
|
|
# https://github.com/golang/go/issues/75031
|
|
- name: Set toolchain version
|
|
run: go env -w GOTOOLCHAIN=go1.25.4+auto
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
|
|
with:
|
|
version: v2.7.1
|
|
|
|
- name: Validate Go modules
|
|
run: ./scripts/validate
|
|
|
|
- name: Test
|
|
run: ./scripts/test
|
|
|
|
- name: Get Tag
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: echo "GITHUB_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
|
|
|
|
- name: Build
|
|
env:
|
|
CROSS: 1
|
|
run: ./scripts/build
|
|
|
|
- name: Package
|
|
run: |
|
|
./scripts/package
|
|
ls -lR dist/artifacts
|
|
# Stage binary for packaging step
|
|
cp -r ./bin/* ./package/
|
|
|
|
# Export the tag for the next step
|
|
source ./scripts/version
|
|
echo "VERSION=$VERSION"
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Docker Build
|
|
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
|
|
with:
|
|
push: false
|
|
context: package
|
|
tags: rancher/cli2:${{ env.VERSION }}
|