diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index fca3739..631e297 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -13,9 +13,21 @@ jobs: # We need the full history for the commitlint task with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.head_ref }} - name: Install Task uses: arduino/setup-task@v2 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install commitlint + run: | + npm install conventional-changelog-conventionalcommits + npm install commitlint@latest + npm install @commitlint/{config-conventional,cli} + - name: Validate PR commits with commitlint + run: npx commitlint --from origin/main --to HEAD --verbose + - name: Validate PR commits with commitlint2 + run: docker run --user $(id -u):$(id -g) -v $(pwd):/src -w /src commitlint/commitlint:19.3.1 --from HEAD~3 --to HEAD - name: Install Dagger env: # renovate: datasource=github-tags depName=dagger/dagger versioning=semver @@ -23,5 +35,7 @@ jobs: run: | curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh - name: Run CI task + env: + COMMIT_LEN: ${{ github.event.pull_request.commits }} run: | task ci diff --git a/Taskfile.yml b/Taskfile.yml index 32a9841..6d2d68d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -13,12 +13,11 @@ tasks: protoc-gen-go-grpc: desc: Compile proto files - deps: - - protolint env: # renovate: datasource=git-refs depName=protoc-gen-go-grpc lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main DAGGER_PROTOC_GEN_GO_GRPC_SHA: f09d41cb90701db446048a9f20eb03495e50f727 cmds: + - task: protolint - > dagger -s call -m github.com/cloudnative-pg/daggerverse/protoc-gen-go-grpc@${DAGGER_PROTOC_GEN_GO_GRPC_SHA} run --source . --go-opt module=github.com/cloudnative-pg/cnpg-i --go-grpcopt module=github.com/cloudnative-pg/cnpg-i --proto-path proto -o . @@ -27,12 +26,11 @@ tasks: lint: desc: Run golangci-lint - deps: - - protoc-gen-go-grpc env: # renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main DAGGER_GOLANGCI_LINT_SHA: b249f27c0d6a2183cd368ae767fc912a09a1a40f cmds: + - task: protoc-gen-go-grpc - > dagger -s call -m github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA} run --source . --config .golangci.yml stdout @@ -54,27 +52,33 @@ tasks: env: # renovate: datasource=git-refs depName=commitlint lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main DAGGER_COMMITLINT_SHA: f09d41cb90701db446048a9f20eb03495e50f727 + FROM: 'origin/main' + TO: 'HEAD' cmds: - - dagger -s call -m github.com/cloudnative-pg/daggerverse/commitlint@${DAGGER_COMMITLINT_SHA} lint --source . --args "--from=origin/main" stdout + - env + - git branch -a + - git rev-parse HEAD + - git rev-parse origin/main + - git log origin/main..HEAD + - dagger call -m github.com/cloudnative-pg/daggerverse/commitlint@${DAGGER_COMMITLINT_SHA} lint --source . --args "--from=${TO}~${COMMIT_LEN}" --args "--to=${TO}" stderr uncommitted: desc: Check for uncommitted changes - deps: - - lint - - protoc-gen-doc env: # renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main DAGGER_UNCOMMITTED_SHA: f09d41cb90701db446048a9f20eb03495e50f727 cmds: + - task: lint + - task: protoc-gen-doc - dagger -s call -m github.com/cloudnative-pg/daggerverse/uncommitted@${DAGGER_UNCOMMITTED_SHA} check-uncommitted --source . stdout sources: - ./** ci: desc: Run the CI pipeline - deps: - - commitlint - - uncommitted + cmds: + - task: commitlint + - task: uncommitted clean: desc: Remove autogenerated artifacts