mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-20 08:13:23 +00:00
* Feat: revert ci to kind Signed-off-by: Somefive <yd219913@alibaba-inc.com> * feat: use internal runner Signed-off-by: Somefive <yd219913@alibaba-inc.com> * fix test bug Signed-off-by: Somefive <yd219913@alibaba-inc.com> --------- Signed-off-by: Somefive <yd219913@alibaba-inc.com>
205 lines
5.9 KiB
YAML
205 lines
5.9 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
workflow_dispatch: {}
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
|
|
permissions: # added using https://github.com/step-security/secure-workflows
|
|
contents: read
|
|
|
|
env:
|
|
# Common versions
|
|
GO_VERSION: '1.19'
|
|
GOLANGCI_VERSION: 'v1.49'
|
|
|
|
jobs:
|
|
|
|
detect-noop:
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
noop: ${{ steps.noop.outputs.should_skip }}
|
|
permissions:
|
|
actions: write
|
|
steps:
|
|
- name: Detect No-op Changes
|
|
id: noop
|
|
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
|
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
|
continue-on-error: true
|
|
|
|
staticcheck:
|
|
runs-on: ubuntu-22.04
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
|
|
steps:
|
|
- name: Setup Go
|
|
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Static Check
|
|
run: make staticcheck
|
|
|
|
- name: License Header Check
|
|
run: make check-license-header
|
|
|
|
lint:
|
|
runs-on: ubuntu-22.04
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
permissions:
|
|
contents: read # for actions/checkout to fetch code
|
|
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
|
|
|
steps:
|
|
- name: Setup Go
|
|
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
|
|
# This action uses its own setup-go, which always seems to use the latest
|
|
# stable version of Go. We could run 'make lint' to ensure our desired Go
|
|
# version, but we prefer this action because it leaves 'annotations' (i.e.
|
|
# it comments on PRs to point out linter violations).
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
|
|
with:
|
|
version: ${{ env.GOLANGCI_VERSION }}
|
|
|
|
check-diff:
|
|
runs-on: ubuntu-22.04
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
|
with:
|
|
node-version: '14'
|
|
|
|
- name: Cache Go Dependencies
|
|
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
|
with:
|
|
path: .work/pkg
|
|
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-pkg-
|
|
|
|
- name: Setup KinD
|
|
run: |
|
|
go install sigs.k8s.io/kind@v0.19.0
|
|
kind delete cluster --name kind || true
|
|
kind create cluster --name kind --image=kindest/node:v1.26.4 --kubeconfig ~/.kube/config
|
|
|
|
- name: Run cross-build
|
|
run: make cross-build
|
|
|
|
- name: Check Diff
|
|
run: |
|
|
export PATH=$(pwd)/bin/:$PATH
|
|
make check-diff
|
|
|
|
- name: Cleanup binary
|
|
run: make build-cleanup
|
|
|
|
check-windows:
|
|
runs-on: windows-latest
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Cache Go Dependencies
|
|
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
|
with:
|
|
path: .work/pkg
|
|
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-pkg-
|
|
|
|
- name: Run Build CLI
|
|
run: make vela-cli
|
|
|
|
- name: Run CLI for version
|
|
shell: cmd
|
|
run: |
|
|
move .\bin\vela .\bin\vela.exe
|
|
.\bin\vela.exe version
|
|
|
|
check-core-image-build:
|
|
runs-on: ubuntu-22.04
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
|
|
- name: Build Test for vela core
|
|
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
check-cli-image-build:
|
|
runs-on: ubuntu-22.04
|
|
needs: detect-noop
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
with:
|
|
submodules: true
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
|
|
- name: Build Test for CLI
|
|
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile.cli
|