-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from Makefile and shell scripts to Taskfile and Dagger, with a CI validating the following: * commits should follow conventional commits standard * no files should be left uncommitted * correct spelling * go linters * go unit tests Closes: #6 Signed-off-by: Francesco Canovai <[email protected]>
- Loading branch information
Showing
16 changed files
with
190 additions
and
237 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/go:1-bullseye" | ||
"image": "mcr.microsoft.com/devcontainers/go:1-bullseye", | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {} | ||
}, | ||
|
||
"postCreateCommand": "curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh; sh -c \"$(curl --location https://taskfile.dev/install.sh)\" -- -d -b $HOME/.local/bin", | ||
} | ||
|
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,29 +1,27 @@ | ||
name: Plugin PVC Backup CI | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.19.0' | ||
- run: make check | ||
name: "Linters" | ||
|
||
unit-tests: | ||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# We need the full history for the commitlint task | ||
with: | ||
go-version: '>=1.19.0' | ||
- run: make test | ||
name: "Unit tests" | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Install Task | ||
uses: arduino/setup-task@v2 | ||
- name: Install Dagger | ||
env: | ||
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver | ||
DAGGER_VERSION: 0.11.9 | ||
run: | | ||
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh | ||
- name: Run CI task | ||
run: | | ||
task ci |
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,18 +1,16 @@ | ||
name: release-please | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
- uses: google-github-actions/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: go | ||
package-name: plugin_pvc_backup | ||
token: ${{secrets.REPO_PAT}} | ||
token: ${{ secrets.REPO_PAT }} |
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,6 @@ | ||
bin/ | ||
dist/ | ||
.env | ||
.vscode/ | ||
.idea/ | ||
.task/ | ||
.vscode/ |
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,5 +1,5 @@ | ||
matrix: | ||
- name: Python Source | ||
- name: Source | ||
sources: | ||
- ./**/*.go | ||
- ./**/*.md | ||
|
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,2 +1 @@ | ||
sidebarToggle | ||
pvc | ||
cnpg |
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,75 @@ | ||
version: '3' | ||
|
||
tasks: | ||
spellcheck: | ||
desc: Run spellcheck | ||
env: | ||
# renovate: datasource=git-refs depName=spellcheck lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main | ||
DAGGER_SPELLCHECK_SHA: 2b7d0f2bfe2c36ae415d34dcf6767a0cd831fc53 | ||
cmds: | ||
- > | ||
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/spellcheck@${DAGGER_SPELLCHECK_SHA} | ||
spellcheck --source . stdout | ||
sources: | ||
- ./** | ||
|
||
lint: | ||
desc: Run golangci-lint | ||
env: | ||
# renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main | ||
DAGGER_GOLANGCI_LINT_SHA: b249f27c0d6a2183cd368ae767fc912a09a1a40f | ||
cmds: | ||
- > | ||
GITHUB_REF= dagger -s call -m github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA} | ||
run --source . --config .golangci.yml stdout | ||
sources: | ||
- ./**/*.go | ||
- .golangci.yml | ||
|
||
commitlint: | ||
desc: Check for conventional commits | ||
env: | ||
# renovate: datasource=git-refs depName=commitlint lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main | ||
DAGGER_COMMITLINT_SHA: 2b7d0f2bfe2c36ae415d34dcf6767a0cd831fc53 | ||
cmds: | ||
- GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/commitlint@${DAGGER_COMMITLINT_SHA} lint --source . --args "--from=origin/main" stdout | ||
|
||
uncommitted: | ||
desc: Check for uncommitted changes | ||
env: | ||
# renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main | ||
DAGGER_UNCOMMITTED_SHA: 2b7d0f2bfe2c36ae415d34dcf6767a0cd831fc53 | ||
cmds: | ||
- > | ||
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/uncommitted@${DAGGER_UNCOMMITTED_SHA} | ||
check-uncommitted --source . stdout | ||
sources: | ||
- ./** | ||
|
||
go-test: | ||
desc: Run go test | ||
env: | ||
# TODO: configure renovate | ||
GOLANG_IMAGE_VERSION: golang:1.22.4 | ||
# renovate: datasource=git-refs depName=gotest lookupName=https://github.com/Excoriate/daggerverse currentValue=main | ||
DAGGER_GOTEST_SHA: f09d41cb90701db446048a9f20eb03495e50f727 | ||
cmds: | ||
- > | ||
GITHUB_REF= dagger -s call -m github.com/Excoriate/daggerverse/gotest@90a5d911a70510f9004544d4a25d39d917f1f668 | ||
base --image-url ${GOLANG_IMAGE_VERSION} | ||
with-cgo-disabled | ||
run-go-test --src . | ||
ci: | ||
desc: Run the CI pipeline | ||
deps: | ||
- commitlint | ||
- uncommitted | ||
- spellcheck | ||
- lint | ||
- go-test | ||
|
||
clean: | ||
desc: Remove autogenerated artifacts | ||
cmds: | ||
- rm -rf .task/ |
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,12 @@ | ||
const Configuration= { | ||
extends: ['@commitlint/config-conventional'], | ||
formatter: '@commitlint/format', | ||
rules: { | ||
'body-empty': [1, 'never'], | ||
'body-case': [2, 'always', 'sentence-case'], | ||
'references-empty': [1, 'never'], | ||
'signed-off-by': [2, 'always', 'Signed-off-by:'], | ||
}, | ||
}; | ||
|
||
module.exports = Configuration; |
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.