From cb46d4c7b60f8edfecf4c73ce71360e128756f5a Mon Sep 17 00:00:00 2001 From: WeebDataHoarder Date: Wed, 30 Apr 2025 10:44:47 +0200 Subject: [PATCH] ci: trigger builds on PRs --- .drone.jsonnet | 7 +++-- .drone.yml | 83 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 3fa475f..79ef005 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -144,8 +144,11 @@ local goVersion = "1.24"; local mirror = "https://mirror.gcr.io"; [ - Build(mirror, goVersion, alpineVersion, "linux", "amd64"), - Build(mirror, goVersion, alpineVersion, "linux", "arm64"), + Build(mirror, goVersion, alpineVersion, "linux", "amd64") + {"trigger": {event: ["push"], branch: ["*"], }}, + Build(mirror, goVersion, alpineVersion, "linux", "arm64") + {"trigger": {event: ["push"], branch: ["*"], }}, + + # Test PRs + Build(mirror, goVersion, alpineVersion, "linux", "amd64") + {"name": "test-pr", "trigger": {event: ["pull_request"], }}, # latest Publish(mirror, "git.gammaspectra.live", "git.gammaspectra.live/git/go-away", "git", goVersion, alpineVersion, "linux", "amd64", {event: ["push"], branch: ["master"], }, containerArchitectures, {tags: ["latest"],}) + {name: "publish-latest-git"}, diff --git a/.drone.yml b/.drone.yml index 1d6067f..d27e3ff 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,6 +65,11 @@ steps: image: alpine:3.21 mirror: https://mirror.gcr.io name: test-wasm-fail +trigger: + branch: + - '*' + event: + - push type: docker --- environment: @@ -133,6 +138,82 @@ steps: image: alpine:3.21 mirror: https://mirror.gcr.io name: test-wasm-fail +trigger: + branch: + - '*' + event: + - push +type: docker +--- +environment: + CGO_ENABLED: "0" + GOARCH: amd64 + GOOS: linux + GOTOOLCHAIN: local +kind: pipeline +name: test-pr +platform: + arch: amd64 + os: linux +steps: +- commands: + - apk update + - apk add --no-cache git + - mkdir .bin + - go build -v -pgo=auto -v -trimpath -ldflags=-buildid= -o ./.bin/go-away ./cmd/go-away + - go build -v -o ./.bin/test-wasm-runtime ./cmd/test-wasm-runtime + image: golang:1.24-alpine3.21 + mirror: https://mirror.gcr.io + name: build +- commands: + - ./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 + --policy examples/forgejo.yml --policy-snippets examples/snippets/ + depends_on: + - build + image: alpine:3.21 + mirror: https://mirror.gcr.io + name: check-policy-forgejo +- commands: + - ./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 + --policy examples/generic.yml --policy-snippets examples/snippets/ + depends_on: + - build + image: alpine:3.21 + mirror: https://mirror.gcr.io + name: check-policy-generic +- commands: + - ./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 + --policy examples/spa.yml --policy-snippets examples/snippets/ + depends_on: + - build + image: alpine:3.21 + mirror: https://mirror.gcr.io + name: check-policy-spa +- commands: + - ./.bin/test-wasm-runtime -wasm ./embed/challenge/js-pow-sha256/runtime/runtime.wasm + -make-challenge ./embed/challenge/js-pow-sha256/test/make-challenge.json -make-challenge-out + ./embed/challenge/js-pow-sha256/test/make-challenge-out.json -verify-challenge + ./embed/challenge/js-pow-sha256/test/verify-challenge.json -verify-challenge-out + 0 + depends_on: + - build + image: alpine:3.21 + mirror: https://mirror.gcr.io + name: test-wasm-success +- commands: + - ./.bin/test-wasm-runtime -wasm ./embed/challenge/js-pow-sha256/runtime/runtime.wasm + -make-challenge ./embed/challenge/js-pow-sha256/test/make-challenge.json -make-challenge-out + ./embed/challenge/js-pow-sha256/test/make-challenge-out.json -verify-challenge + ./embed/challenge/js-pow-sha256/test/verify-challenge-fail.json -verify-challenge-out + 1 + depends_on: + - build + image: alpine:3.21 + mirror: https://mirror.gcr.io + name: test-wasm-fail +trigger: + event: + - pull_request type: docker --- kind: pipeline @@ -424,6 +505,6 @@ trigger: type: docker --- kind: signature -hmac: 6eab8ae9773b048e780db2bf9d440095eb5615d0baf8da71878069ad7124e167 +hmac: 5200d5eb519acb0f74a7b62b103399da23d6e994d63c20052b41b10a4654b37a ...