-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
221 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release-* | ||
workflow_dispatch: {} | ||
pull_request: | ||
branches: | ||
- main | ||
- release-* | ||
paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"] | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.17' | ||
|
||
jobs: | ||
|
||
detect-noop: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
noop: ${{ steps.noop.outputs.should_skip }} | ||
steps: | ||
- name: Detect No-op Changes | ||
id: noop | ||
uses: fkirc/skip-duplicate-actions@v4.0.0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | ||
concurrent_skipping: false | ||
|
||
staticcheck: | ||
runs-on: ubuntu-latest | ||
needs: detect-noop | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
|
||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: StaticCheck | ||
run: GO111MODULE=auto make staticcheck | ||
|
||
lint: | ||
name: "Lint" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Set up Go ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
|
||
- name: golangci-lint | ||
run: make lint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: azure-aci-test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release-* | ||
workflow_dispatch: {} | ||
pull_request: | ||
branches: | ||
- main | ||
- release-* | ||
paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"] | ||
|
||
|
||
jobs: | ||
detect-noop: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
noop: ${{ steps.noop.outputs.should_skip }} | ||
steps: | ||
- name: Detect No-op Changes | ||
id: noop | ||
uses: fkirc/skip-duplicate-actions@v4.0.0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | ||
concurrent_skipping: false | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
needs: detect-noop | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run go vet | ||
uses: make vet | ||
|
||
- name: Run unit tests & Generate coverage | ||
run: make testauth test | ||
|
||
- name: Upload Codecov report | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
## Repository upload token - get it from codecov.io. Required only for private repositories | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
## Comma-separated list of files to upload | ||
files: ./coverage.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
run: | ||
deadline: 10m | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- errorlint | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nilerr | ||
- prealloc | ||
- revive | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- varcheck | ||
- whitespace | ||
# Run with --fast=false for more extensive checks | ||
fast: true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
# https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/master/scripts/go_install.sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
if [[ -z "${1}" ]]; then | ||
echo "must provide module as first parameter" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${2}" ]]; then | ||
echo "must provide binary name as second parameter" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${3}" ]]; then | ||
echo "must provide version as third parameter" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${GOBIN}" ]]; then | ||
echo "GOBIN is not set. Must set GOBIN to install the bin in a specified directory." | ||
exit 1 | ||
fi | ||
|
||
tmp_dir=$(mktemp -d -t goinstall_XXXXXXXXXX) | ||
function clean { | ||
rm -rf "${tmp_dir}" | ||
} | ||
trap clean EXIT | ||
|
||
rm "${GOBIN}/${2}"* || true | ||
|
||
cd "${tmp_dir}" | ||
|
||
# create a new module in the tmp directory | ||
go mod init fake/mod | ||
|
||
# install the golang module specified as the first argument | ||
go install "${1}@${3}" | ||
mv "${GOBIN}/${2}" "${GOBIN}/${2}-${3}" | ||
ln -sf "${GOBIN}/${2}-${3}" "${GOBIN}/${2}" |