Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
day: monday
time: "03:00"
timezone: Etc/UTC
open-pull-requests-limit: 5
commit-message:
prefix: deps

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: "03:15"
timezone: Etc/UTC
open-pull-requests-limit: 3
commit-message:
prefix: ci
146 changes: 112 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,121 @@ on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- run: test -z "$(gofmt -l .)"
- run: go vet ./...

test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- run: go test ./... -timeout 15m
cache: false
- run: go test ./... -covermode=atomic -coverprofile=coverage.out -timeout 15m
- run: go tool cover -func=coverage.out
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: unit-coverage
path: coverage.out
if-no-files-found: error

race:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- run: go test -race ./... -timeout 20m

build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- run: go build ./...

integration:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- run: go test -tags=integration ./test/integration/... -timeout 20m

integration-race:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- run: go test -race -tags=integration ./test/integration/... -timeout 25m

release-dry-run:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false
- name: Run release packaging dry-run
run: |
chmod +x scripts/build-release-artifacts.sh
VERSION=0.0.0-dry-run COMMIT=DRY-RUN BUILD_DATE=$(date -u +%Y-%m-%d) \
./scripts/build-release-artifacts.sh ./dist
SOURCE_DATE_EPOCH=$(git show -s --format=%ct "$GITHUB_SHA")
export SOURCE_DATE_EPOCH
BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%d)
VERSION=0.0.0-dry-run COMMIT=DRY-RUN BUILD_DATE="$BUILD_DATE" \
bash scripts/verify-reproducible-release.sh ./dist
- name: Verify archives
run: |
set -euo pipefail
Expand All @@ -111,7 +138,58 @@ jobs:
test -f checksums.txt || { echo "checksums.txt missing"; exit 1; }
sha256sum -c checksums.txt || { echo "Checksum verification failed"; exit 1; }
echo "All archives valid"
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-dry-run
path: dist/*
if-no-files-found: error

platform-smoke:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: false
- run: go test ./... -timeout 15m
- run: go build ./cmd/taskcapsule

govulncheck:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: false
- run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...

codeql:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
packages: read
security-events: write
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: github/codeql-action/init@bce182f857edf1feab116e9795a3393d21977282 # v4
with:
languages: go
- uses: github/codeql-action/analyze@bce182f857edf1feab116e9795a3393d21977282 # v4
with:
category: /language:go
84 changes: 61 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ on:
required: true
default: 'true'

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: read

jobs:
validate-and-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false

- name: Validate tag or branch
run: |
Expand Down Expand Up @@ -59,36 +65,56 @@ jobs:
needs: [validate-and-test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false

- name: Build and package all targets
run: |
chmod +x scripts/build-release-artifacts.sh
SOURCE_DATE_EPOCH=$(git show -s --format=%ct "$GITHUB_SHA")
export SOURCE_DATE_EPOCH
VERSION="${GITHUB_REF_NAME#v}" \
COMMIT="$GITHUB_SHA" \
BUILD_DATE="$(date -u +%Y-%m-%d)" \
./scripts/build-release-artifacts.sh ./dist
BUILD_DATE="$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%d)" \
bash scripts/verify-reproducible-release.sh ./dist

- name: Generate CycloneDX SBOM
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
with:
path: .
format: cyclonedx-json
artifact-name: taskcapsule-${{ github.ref_name }}.cdx.json
output-file: dist/taskcapsule-${{ github.ref_name }}.cdx.json
upload-artifact: false

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-artifacts
path: dist/*
if-no-files-found: error

release:
needs: [validate-and-test, build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
attestations: write
artifact-metadata: write
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: artifacts
merge-multiple: true
Expand All @@ -99,12 +125,20 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt
ls -la

- name: Attest archives and SBOM
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-path: |
artifacts/*.tar.gz
artifacts/*.zip
sbom-path: artifacts/taskcapsule-${{ github.ref_name }}.cdx.json

- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
artifacts/*.tar.gz artifacts/*.zip artifacts/checksums.txt \
artifacts/*.tar.gz artifacts/*.zip artifacts/checksums.txt artifacts/*.cdx.json \
--repo "$GITHUB_REPOSITORY" \
--title "TaskCapsule $GITHUB_REF_NAME" \
--notes "See the [CHANGELOG](https://github.com/$GITHUB_REPOSITORY/blob/main/CHANGELOG.md) for details." \
Expand All @@ -115,21 +149,24 @@ jobs:
needs: [validate-and-test]
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
cache: false

- name: Package all targets
run: |
chmod +x scripts/build-release-artifacts.sh
SOURCE_DATE_EPOCH=$(git show -s --format=%ct "$GITHUB_SHA")
export SOURCE_DATE_EPOCH
VERSION=0.0.0-dry-run \
COMMIT=DRY-RUN \
BUILD_DATE=$(date -u +%Y-%m-%d) \
./scripts/build-release-artifacts.sh ./dist
BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%d) \
bash scripts/verify-reproducible-release.sh ./dist

- name: Verify all 5 archives exist
run: |
Expand Down Expand Up @@ -172,7 +209,8 @@ jobs:
sha256sum -c checksums.txt || { echo "checksum verification failed"; exit 1; }
echo "All checksums valid"

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-dry-run
path: dist/*
if-no-files-found: error
Loading