This commit is contained in:
@@ -17,13 +17,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||||
- uses: actions/setup-go@v7
|
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
|
||||||
with:
|
with:
|
||||||
go-version: "1.26.5"
|
go-version: "1.26.5"
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: go.mod
|
cache-dependency-path: go.mod
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||||
with:
|
with:
|
||||||
bun-version: "1.3.13"
|
bun-version: "1.3.13"
|
||||||
- name: Verify Go and OpenSpec baseline
|
- name: Verify Go and OpenSpec baseline
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
file dist/verse-gateway-linux-* | tee dist/file.txt
|
file dist/verse-gateway-linux-* | tee dist/file.txt
|
||||||
go version -m dist/verse-gateway-linux-amd64 > dist/go-version-amd64.txt
|
go version -m dist/verse-gateway-linux-amd64 > dist/go-version-amd64.txt
|
||||||
go version -m dist/verse-gateway-linux-arm64 > dist/go-version-arm64.txt
|
go version -m dist/verse-gateway-linux-arm64 > dist/go-version-arm64.txt
|
||||||
- uses: christopherhx/gitea-upload-artifact@v4
|
- uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
|
||||||
with:
|
with:
|
||||||
name: verse-gateway-linux-${{ gitea.sha }}
|
name: verse-gateway-linux-${{ gitea.sha }}
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|||||||
@@ -1,15 +1,37 @@
|
|||||||
package gateway
|
package gateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"debug/buildinfo"
|
"debug/buildinfo"
|
||||||
"debug/elf"
|
"debug/elf"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestCIActionReferencesAreImmutable(t *testing.T) {
|
||||||
|
workflow, err := os.Open(filepath.Join("..", ".gitea", "workflows", "verify.yml"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer workflow.Close()
|
||||||
|
immutable := regexp.MustCompile(`@[0-9a-f]{40}(?:\s+#.*)?$`)
|
||||||
|
scanner := bufio.NewScanner(workflow)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := strings.TrimSpace(scanner.Text())
|
||||||
|
if strings.HasPrefix(line, "- uses:") && !immutable.MatchString(line) {
|
||||||
|
t.Errorf("mutable CI action reference: %s", line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := scanner.Err(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGatewayLinuxArtifactsAreReproduciblePureGoELF(t *testing.T) {
|
func TestGatewayLinuxArtifactsAreReproduciblePureGoELF(t *testing.T) {
|
||||||
first, second := t.TempDir(), t.TempDir()
|
first, second := t.TempDir(), t.TempDir()
|
||||||
for _, output := range []string{first, second} {
|
for _, output := range []string{first, second} {
|
||||||
|
|||||||
Reference in New Issue
Block a user