forked from flant/shell-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request flant#324 from flant/migrate_to_go_1_16
Migrate to Go 1.16
- Loading branch information
Showing
15 changed files
with
532 additions
and
347 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,14 +7,11 @@ jobs: | |
build_linux_binary: | ||
name: Build shell-operator binary | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Check out shell-operator code | ||
uses: actions/[email protected] | ||
|
@@ -74,15 +71,15 @@ jobs: | |
- name: Prepare environment | ||
run: | | ||
echo ::set-env name=CGO_ENABLED::1 | ||
echo "CGO_ENABLED=1" >> "${GITHUB_ENV}" | ||
CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include" | ||
echo ::set-env name=CGO_CFLAGS::${CGO_CFLAGS} | ||
echo "CGO_CFLAGS=${CGO_CFLAGS}" >> "${GITHUB_ENV}" | ||
CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib" | ||
echo ::set-env name=CGO_LDFLAGS::${CGO_LDFLAGS} | ||
echo "CGO_LDFLAGS=${CGO_LDFLAGS}" >> "${GITHUB_ENV}" | ||
echo ::set-env name=GOOS::linux | ||
echo "GOOS=linux" >> "${GITHUB_ENV}" | ||
- name: Build binary | ||
run: | | ||
|
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 |
---|---|---|
|
@@ -10,10 +10,10 @@ jobs: | |
name: Go code style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
go-version: 1.16 | ||
|
||
- uses: actions/[email protected] | ||
|
||
|
@@ -25,10 +25,10 @@ jobs: | |
name: codespell | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
go-version: 1.16 | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
|
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 |
---|---|---|
|
@@ -8,14 +8,11 @@ jobs: | |
run_linter: | ||
name: Run linter | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Check out shell-operator code | ||
uses: actions/[email protected] | ||
|
@@ -75,15 +72,15 @@ jobs: | |
- name: Prepare environment | ||
run: | | ||
echo ::set-env name=CGO_ENABLED::1 | ||
echo "CGO_ENABLED=1" >> "${GITHUB_ENV}" | ||
CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include" | ||
echo ::set-env name=CGO_CFLAGS::${CGO_CFLAGS} | ||
echo "CGO_CFLAGS=${CGO_CFLAGS}" >> "${GITHUB_ENV}" | ||
CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib" | ||
echo ::set-env name=CGO_LDFLAGS::${CGO_LDFLAGS} | ||
echo "CGO_LDFLAGS=${CGO_LDFLAGS}" >> "${GITHUB_ENV}" | ||
echo ::set-env name=GOOS::linux | ||
echo "GOOS=linux" >> "${GITHUB_ENV}" | ||
- name: Run golangci-lint | ||
run: | | ||
|
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
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 |
---|---|---|
|
@@ -31,21 +31,18 @@ jobs: | |
name: context.payload.label.name, | ||
}); | ||
} catch (e) { | ||
console.log(`Error occured while remove label. Possibly label is already removed. Ignore '${typeof e}' error.`); | ||
console.log(`Error occurred while remove label. Possibly label is already removed. Ignore '${typeof e}' error.`); | ||
} | ||
build_and_run_unit_tests: | ||
name: Build and unit tests | ||
if: github.event_name == 'push' && github.event.ref != 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Check out shell-operator code | ||
uses: actions/[email protected] | ||
|
@@ -105,15 +102,15 @@ jobs: | |
- name: Prepare environment | ||
run: | | ||
echo ::set-env name=CGO_ENABLED::1 | ||
echo "CGO_ENABLED=1" >> "${GITHUB_ENV}" | ||
CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include" | ||
echo ::set-env name=CGO_CFLAGS::${CGO_CFLAGS} | ||
echo "CGO_CFLAGS=${CGO_CFLAGS}" >> "${GITHUB_ENV}" | ||
CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib" | ||
echo ::set-env name=CGO_LDFLAGS::${CGO_LDFLAGS} | ||
echo "CGO_LDFLAGS=${CGO_LDFLAGS}" >> "${GITHUB_ENV}" | ||
echo ::set-env name=GOOS::linux | ||
echo "GOOS=linux" >> "${GITHUB_ENV}" | ||
- name: Run unit tests | ||
run: | | ||
|
@@ -125,14 +122,11 @@ jobs: | |
name: Download modules and build libjq | ||
if: (github.event_name == 'push' && github.event.ref == 'refs/heads/master') || (github.event_name == 'pull_request' && github.event.label.id == 1838578615) | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Check out shell-operator code | ||
uses: actions/[email protected] | ||
|
@@ -203,17 +197,14 @@ jobs: | |
if: (github.event_name == 'push' && github.event.ref == 'refs/heads/master') || (github.event_name == 'pull_request' && github.event.label.id == 1838578615) | ||
needs: prepare_build_dependencies | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Download go modules artifact | ||
uses: actions/download-artifact@master | ||
|
@@ -235,17 +226,17 @@ jobs: | |
run: | | ||
export COVERAGE_DIR=$GITHUB_WORKSPACE/coverage_reports/unit_tests/${{ matrix.os }} | ||
mkdir -p $COVERAGE_DIR | ||
echo ::set-env name=COVERAGE_DIR::$COVERAGE_DIR | ||
echo "COVERAGE_DIR=$COVERAGE_DIR" >> "${GITHUB_ENV}" | ||
echo ::set-env name=CGO_ENABLED::1 | ||
echo "CGO_ENABLED=1" >> "${GITHUB_ENV}" | ||
CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include" | ||
echo ::set-env name=CGO_CFLAGS::${CGO_CFLAGS} | ||
echo "CGO_CFLAGS=${CGO_CFLAGS}" >> "${GITHUB_ENV}" | ||
CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib" | ||
echo ::set-env name=CGO_LDFLAGS::${CGO_LDFLAGS} | ||
echo "CGO_LDFLAGS=${CGO_LDFLAGS}" >> "${GITHUB_ENV}" | ||
echo ::set-env name=GOOS::linux | ||
echo "GOOS=linux" >> "${GITHUB_ENV}" | ||
shell: bash | ||
|
||
|
@@ -271,19 +262,25 @@ jobs: | |
strategy: | ||
fail-fast: true | ||
matrix: | ||
k8s_version: ["1.16", "1.19", "1.20"] | ||
include: | ||
- k8s_version: "1.16" | ||
kind_node_image: "kindest/node:v1.16.15" | ||
cluster_name: "kube-1-16" | ||
- k8s_version: "1.19" | ||
kind_node_image: "kindest/node:v1.19.7" | ||
cluster_name: "kube-1-19" | ||
- k8s_version: "1.20" | ||
kind_node_image: "kindest/node:v1.20.2" | ||
cluster_name: "kube-1-20" | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Go 1.15 | ||
- name: Set up Go 1.16 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
id: go | ||
go-version: 1.16 | ||
|
||
- name: Download go modules artifact | ||
uses: actions/download-artifact@master | ||
|
@@ -301,71 +298,37 @@ jobs: | |
name: libjq | ||
path: libjq | ||
|
||
- name: Prepare environment | ||
- name: Install ginkgo | ||
run: | | ||
# note that onsi/ginkgo is replaced by flant/ginkgo with fixes for combining coverage | ||
go build github.com/onsi/ginkgo/ginkgo | ||
./ginkgo version | ||
echo ::set-env name=KIND_CLUSTER_VERSION::${{ matrix.k8s_version }} | ||
export COVERAGE_DIR=$GITHUB_WORKSPACE/coverage_reports/integration_tests/${{ matrix.os }}-k8s-${{ matrix.k8s_version }} | ||
mkdir -p $COVERAGE_DIR | ||
echo ::set-env name=COVERAGE_DIR::$COVERAGE_DIR | ||
echo ::set-env name=CGO_ENABLED::1 | ||
- name: Prepare environment | ||
run: | | ||
echo "CGO_ENABLED=1" >> "${GITHUB_ENV}" | ||
CGO_CFLAGS="-I$GITHUB_WORKSPACE/libjq/include" | ||
echo ::set-env name=CGO_CFLAGS::${CGO_CFLAGS} | ||
echo "CGO_CFLAGS=${CGO_CFLAGS}" >> "${GITHUB_ENV}" | ||
CGO_LDFLAGS="-L$GITHUB_WORKSPACE/libjq/lib" | ||
echo ::set-env name=CGO_LDFLAGS::${CGO_LDFLAGS} | ||
echo "CGO_LDFLAGS=${CGO_LDFLAGS}" >> "${GITHUB_ENV}" | ||
echo "GOOS=linux" >> "${GITHUB_ENV}" | ||
echo ::set-env name=GOOS::linux | ||
- name: Start kind cluster | ||
uses: engineerd/[email protected] | ||
with: | ||
version: "v0.11.1" | ||
image: ${{ matrix.kind_node_image }} | ||
name: ${{ matrix.cluster_name }} | ||
|
||
- name: Run integration tests | ||
env: | ||
CLUSTER_NAME: ${{ matrix.cluster_name }} | ||
run: | | ||
./ginkgo \ | ||
--tags 'integration test' \ | ||
--vet off \ | ||
--race \ | ||
--cover \ | ||
--coverpkg=github.com/flant/shell-operator/pkg/...,github.com/flant/shell-operator/test/utils \ | ||
--coverprofile=coverage.out \ | ||
--outputdir=${COVERAGE_DIR} \ | ||
-p \ | ||
-r test/integration | ||
- name: Upload coverage artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage_reports | ||
path: coverage_reports | ||
|
||
|
||
upload_coverage: | ||
name: Upload coverage | ||
if: (github.event_name == 'push' && github.event.ref == 'refs/heads/master') || (github.event_name == 'pull_request' && github.event.label.id == 1838578615) # push master or ':robot: run e2e matrix' label | ||
needs: | ||
- unit_tests | ||
- integration_tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Download coverage artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: coverage_reports | ||
path: coverage_reports | ||
|
||
- name: Upload report to codeclimate.com | ||
run: | | ||
du -ah coverage_reports | ||
export COVERAGE_DIR=coverage_reports | ||
export GIT_BRANCH=${GITHUB_REF:11} | ||
export GIT_COMMIT_SHA=$GITHUB_SHA | ||
./scripts/ci/codeclimate_upload.sh | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
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
Oops, something went wrong.