Skip to content

Fix metadata projection and validation across context fields #6

Fix metadata projection and validation across context fields

Fix metadata projection and validation across context fields #6

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions: {}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- name: Check dependency graph
run: |
modules="$(go list -m all)"
test "$modules" = github.com/git-pkgs/codemeta
if go list -deps . | grep -qx encoding/json; then
echo "encoding/json must stay outside the parse path"
exit 1
fi
- name: Build and test
run: |
go build ./...
go test ./...
go test -race ./...
- name: Check generated files
run: |
go generate ./...
git diff --exit-code -- terms_generated.go
- name: Compatibility corpus
run: CODEMETA_CORPUS=all go test -run TestCorpus ./...
- name: Fuzz public entry points
run: |
go test -run '^$' -fuzz=FuzzParse -fuzztime=15s
go test -run '^$' -fuzz=FuzzRead -fuzztime=15s
- name: Benchmarks
run: go test -run '^$' -bench=. -benchmem -benchtime=100x
tinygo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- name: Install TinyGo
run: |
curl --fail --location --output "$RUNNER_TEMP/tinygo.tar.gz" https://github.com/tinygo-org/tinygo/releases/download/v0.42.0/tinygo0.42.0.linux-amd64.tar.gz
echo "b87688fa2e19cee7d813cad7fd7dadb71dff3198e47125aba66ba4af5e490438 $RUNNER_TEMP/tinygo.tar.gz" | sha256sum --check
tar -xzf "$RUNNER_TEMP/tinygo.tar.gz" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/tinygo/bin" >> "$GITHUB_PATH"
- name: Build and run consumer
run: |
tinygo build -o "$RUNNER_TEMP/read-tinygo" ./examples/read
go build -o "$RUNNER_TEMP/read-go" ./examples/read
"$RUNNER_TEMP/read-tinygo" testdata/upstream/codemeta-software.json > "$RUNNER_TEMP/tinygo-output"
"$RUNNER_TEMP/read-go" testdata/upstream/codemeta-software.json > "$RUNNER_TEMP/go-output"
diff -u "$RUNNER_TEMP/go-output" "$RUNNER_TEMP/tinygo-output"
"$RUNNER_TEMP/read-tinygo" testdata/projection.json > "$RUNNER_TEMP/tinygo-output"
"$RUNNER_TEMP/read-go" testdata/projection.json > "$RUNNER_TEMP/go-output"
diff -u "$RUNNER_TEMP/go-output" "$RUNNER_TEMP/tinygo-output"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: false
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
with:
version: latest
args: --enable gocritic,gocognit,gocyclo,maintidx,dupl,mnd,unparam,ireturn,goconst,errcheck ./...
- name: Vulnerabilities and reachability
run: |
go run golang.org/x/vuln/cmd/govulncheck@v1.7.0 ./...
go run golang.org/x/tools/cmd/deadcode@v0.49.0 -test ./...