Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic releases using goreleaser #234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bf56512
chore: add goreleaser + cosign releases
shibumi Sep 26, 2021
fc533d7
feat: keyless realeases with goreleaser and cosign
shibumi Nov 16, 2021
0f71eed
chore: try a basic config of gorelease
trishankatdatadog Feb 24, 2022
4859d45
chore: split test and release phases into reusable workflows
rdimitrov Mar 11, 2022
1fc8339
chore: bump goreleaser to v1.6.3
rdimitrov Mar 16, 2022
17a77f9
chore: use golangci-lint instead of go fmt, staticcheck, etc.
rdimitrov Mar 16, 2022
4260b24
chore: use github-action for goveralls instead of the legacy GOPATH way
rdimitrov Mar 16, 2022
5e1875c
chore: add golangci.yml config enabling several other linters
rdimitrov Mar 17, 2022
0149cae
chore: use the flags property of goreleaser instead of env vars while…
rdimitrov Mar 17, 2022
20374ae
chore: set goreleaser to automatically mark releases with a suffix as…
rdimitrov Mar 17, 2022
e9f42ac
chore: partially revert "Add golangci.yml config enabling several oth…
rdimitrov Mar 18, 2022
c9a23fd
chore: add commitsar action to enforce the use of conventional commits
rdimitrov Mar 21, 2022
c2e1f53
fix: use keyword specificed in the conventional commit spec for break…
rdimitrov Mar 21, 2022
8ea6b29
chore: configure dependabot to monitor github-actions too
rdimitrov Mar 24, 2022
790cfc6
chore: pin github-actions dependencies by digest
rdimitrov Mar 24, 2022
27d6d6c
chore: pin and configure dependabot to monitor Python test dependencies
rdimitrov Mar 24, 2022
c32d676
chore: bump goreleaser version to v1.7.0
rdimitrov Mar 24, 2022
53cd095
chore: run tests using Go version 1.18.x
rdimitrov Mar 24, 2022
6f4be57
chore: checkout code first in order to fix CI failure
rdimitrov Mar 24, 2022
e8c8cf9
chore: run CI against all Go versions newer than the minimal one set …
rdimitrov Mar 24, 2022
25e6ace
chore: download python dependencies from requirements-test.txt
rdimitrov Mar 24, 2022
d9d42f1
chore: use the minimal Go version set in go.mod for releases
rdimitrov Mar 24, 2022
89e45e9
chore: pin the go-version-action using a digest
rdimitrov Mar 24, 2022
2b9b0c9
chore: configure dependabot to use chore commit prefix for gomod updates
rdimitrov Mar 24, 2022
f8d33dc
chore: revert the use of dedicated requirements.txt file path for git…
rdimitrov Mar 24, 2022
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
35 changes: 30 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
# Monitor Go dependencies
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
time: "10:00"
commit-message:
prefix: "chore"
include: "scope"
open-pull-requests-limit: 10
# Monitor Github Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "10:00"
commit-message:
prefix: "chore"
include: "scope"
joshuagl marked this conversation as resolved.
Show resolved Hide resolved
open-pull-requests-limit: 10
# Monitor Python test dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
time: "10:00"
commit-message:
prefix: "chore"
include: "scope"
open-pull-requests-limit: 10
41 changes: 0 additions & 41 deletions .github/workflows/build.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
pull_request:
push:
branches:
- "master"
tags:
- "v*"
name: CI
jobs:
tests:
uses: ./.github/workflows/tests.yml
tuf:
needs: tests
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: ./.github/workflows/release.yml
with:
cli-name: tuf
tuf-client:
needs: tests
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: ./.github/workflows/release.yml
with:
cli-name: tuf-client
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
workflow_call:
inputs:
cli-name:
required: true
type: string
name: Release
jobs:
release:
permissions:
id-token: write
trishankatdatadog marked this conversation as resolved.
Show resolved Hide resolved
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
fetch-depth: 0
- name: Get Go version
uses: arnested/go-version-action@d44f8fbecf1ac5ea61d81603e99dfec9833f592f
id: go-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492
with:
go-version: ${{ steps.go-version.outputs.minimal }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@b953231f81b8dfd023c58e0854a721e35037f28b
with:
distribution: goreleaser
version: "v1.7.0"
args: release --config ./.goreleaser/${{ inputs.cli-name }}.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78 changes: 78 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
on:
workflow_call:
name: Tests
jobs:
get-go-versions:
name: Collect available Go versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- uses: arnested/go-version-action@d44f8fbecf1ac5ea61d81603e99dfec9833f592f
id: versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

run:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579

- name: Setup - Go ${{ matrix.go-version }}
uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492
with:
go-version: ${{ matrix.go-version }}

- name: Setup - Python
uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a
with:
python-version: 3.6
cache: "pip"
cache-dependency-path: "requirements-test.txt"

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r requirements-test.txt

- name: Run tests
run: go test -race -covermode atomic -coverprofile='profile.cov' ./...

- name: Send coverage
uses: shogo82148/actions-goveralls@31ee804b8576ae49f6dc3caa22591bc5080e7920
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go-version }}
parallel: true

golangci:
strategy:
matrix:
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: golangci-lint
uses: golangci/golangci-lint-action@5c56cd6c9dc07901af25baab6f2b0d9f3b7c3018
with:
version: v1.44

conventional-commits-lint-check:
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
fetch-depth: 0
- name: Commitsar Action
uses: aevea/commitsar@159cec82966ca402a09ae3c185524a5256affa22
11 changes: 11 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
linters:
disable-all: true
enable:
- staticcheck
- gofmt
- govet
- gosimple
- structcheck
- varcheck
- unused
- typecheck
39 changes: 39 additions & 0 deletions .goreleaser/tuf-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project_name: tuf-client
builds:
- ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
env:
- "CGO_ENABLED=0"
- "GO111MODULE=on"
flags:
- -mod=readonly
- -trimpath
goos:
- linux
- darwin
- windows
goarch:
- amd64
main: ./cmd/tuf-client/
source:
enabled: true
changelog:
use: github
groups:
- title: "Breaking changes"
regexp: "^.*BREAKING CHANGE[(\\w)]*:+.*$"
order: 0
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 1
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 2
- title: Others
order: 999
trishankatdatadog marked this conversation as resolved.
Show resolved Hide resolved
release:
# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
prerelease: auto
39 changes: 39 additions & 0 deletions .goreleaser/tuf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project_name: tuf
builds:
- ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
env:
- "CGO_ENABLED=0"
- "GO111MODULE=on"
flags:
- -mod=readonly
- -trimpath
goos:
- linux
- darwin
- windows
goarch:
- amd64
main: ./cmd/tuf/
source:
enabled: true
changelog:
use: github
groups:
- title: "Breaking changes"
regexp: "^.*BREAKING CHANGE[(\\w)]*:+.*$"
order: 0
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 1
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 2
- title: Others
order: 999
release:
# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
prerelease: auto
5 changes: 5 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
iso8601==1.0.2
requests==2.27.1
securesystemslib==0.21.0
six==1.16.0
tuf==0.20.0