generated from d2iq-archive/golang-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Switch to task from make (#679)
- Loading branch information
1 parent
c0d73ff
commit 0c13e6f
Showing
34 changed files
with
546 additions
and
619 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
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 |
---|---|---|
|
@@ -12,15 +12,20 @@ on: | |
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
TASK_X_ANY_VARIABLES: 1 | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
@@ -33,8 +38,18 @@ jobs: | |
with: | ||
enable-cache: true | ||
|
||
- name: Go cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run unit tests | ||
run: devbox run -- make test | ||
run: devbox run -- task test:unit | ||
|
||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
|
@@ -46,9 +61,6 @@ jobs: | |
e2e-test: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
@@ -69,7 +81,7 @@ jobs: | |
platforms: arm64 | ||
|
||
- name: Run e2e tests | ||
run: devbox run -- make e2e-test | ||
run: devbox run -- task test:e2e | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TMPDIR: ${{ runner.temp }} | ||
|
@@ -84,9 +96,6 @@ jobs: | |
lint: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
@@ -97,39 +106,75 @@ jobs: | |
enable-cache: true | ||
|
||
- name: Export golang and golangci-lint versions | ||
id: versions | ||
run: | | ||
echo "GOLANGCI_LINT_VERSION=v$(devbox run -- golangci-lint version --format short)" >>$GITHUB_ENV | ||
echo "GO_VERSION=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_ENV | ||
echo "golangci-lint=$(devbox run -- golangci-lint version --format short)" >>"${GITHUB_OUTPUT}" | ||
echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>"${GITHUB_OUTPUT}" | ||
- name: golangci-lint | ||
uses: reviewdog/action-golangci-lint@v2 | ||
with: | ||
fail_on_error: true | ||
reporter: github-pr-review | ||
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
go_version: ${{ env.GO_VERSION }} | ||
golangci_lint_version: v${{ steps.versions.outputs.golangci-lint }} | ||
go_version: v${{ steps.versions.outputs.golang }} | ||
|
||
lint-gha: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: actionlint | ||
uses: reviewdog/action-actionlint@v1 | ||
with: | ||
fail_on_error: true | ||
reporter: github-pr-review | ||
|
||
pre-commit: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/[email protected] | ||
with: | ||
enable-cache: true | ||
|
||
- name: Go cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Set up pre-commit cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Run pre-commit | ||
run: devbox run -- make pre-commit | ||
run: devbox run -- task pre-commit:run | ||
env: | ||
SKIP: no-commit-to-branch,golangci-lint | ||
SKIP: no-commit-to-branch,golangci-lint,actionlint-system | ||
|
||
govulncheck: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/[email protected] | ||
with: | ||
enable-cache: true | ||
|
||
- id: govulncheck | ||
run: devbox run -- task go:vulncheck |
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
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
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 |
---|---|---|
|
@@ -26,3 +26,6 @@ dist/ | |
|
||
*.tar.gz | ||
*.tar | ||
|
||
.task | ||
.devbox |
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 |
---|---|---|
@@ -1,4 +1,14 @@ | ||
{ | ||
"go.buildTags": "e2e", | ||
"ginkgotestexplorer.buildTags": "e2e" | ||
"ginkgotestexplorer.buildTags": "e2e", | ||
"yaml.schemas": { | ||
"https://taskfile.dev/schema.json": [ | ||
"tasks/build.yaml", | ||
"tasks/repo.yaml", | ||
"tasks/git.yaml", | ||
"tasks/pre-commit.yaml", | ||
"tasks/go.yaml", | ||
"tasks/test.yaml" | ||
] | ||
} | ||
} |
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,16 @@ | ||
# Copyright 2024 D2iQ, Inc. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
version: '3' | ||
|
||
set: | ||
- errexit | ||
- nounset | ||
- pipefail | ||
|
||
includes: | ||
build: ./tasks/build.yaml | ||
git: ./tasks/git.yaml | ||
pre-commit: ./tasks/pre-commit.yaml | ||
go: ./tasks/go.yaml | ||
test: ./tasks/test.yaml |
Oops, something went wrong.