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

ci: use reusable workflows and shared renovate config #61

Merged
merged 1 commit into from
Dec 14, 2023
Merged
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
16 changes: 0 additions & 16 deletions .github/renovate.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'github>HyperaDev/actions',
],
}
61 changes: 7 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,17 @@
# GitHub Actions workflow to build, test and publish the project.
# GitHub Actions workflow to build and test a Go project.
name: "Go"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
GO_VERSION: "1.21.3"
merge_group:

jobs:
govulncheck:
name: "Vulnerability Check"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Go ${{ env.GO_VERSION }}"
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true

- name: "Install"
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: "Run"
run: govulncheck ./...

build:
name: "Build"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Go ${{ env.GO_VERSION }}"
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true

- name: "Download dependencies"
run: go mod download

- name: "Verify dependencies"
run: go mod verify

- name: "Build"
run: go build -v ./...

- name: "Test"
run: go test -v ./...

- name: "Test (race)"
run: go test -race -v ./...

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
uses: HyperaDev/actions/.github/workflows/go-build.yml@main
with:
go_version: "stable"
codecov_enabled: true
vulncheck_enabled: true
68 changes: 9 additions & 59 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,17 @@
# GitHub Actions workflow to create a new release
# GitHub Actions workflow to release a Go project using GoReleaser.
# Releases are published from tags matching "v*.*.*".
name: "Release"
on:
push:
tags: [ "v*.*.*" ]

concurrency:
group: release
cancel-in-progress: true

env:
GO_VERSION: "1.21.3"

jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
permissions:
contents: read
packages: write
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Set up Go ${{ env.GO_VERSION }}"
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
check-latest: true

- name: "Run go mod tidy"
run: go mod tidy

- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Login to DockerHub"
uses: docker/login-action@v3
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_TOKEN }}"

- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "Release"
uses: goreleaser/goreleaser-action@v5
with:
version: "latest"
distribution: "goreleaser"
args: "release --clean"
env:
GITHUB_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}"

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
uses: HyperaDev/actions/.github/workflows/go-release.yml@main
with:
docker_enabled: true
secrets:
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}"
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}"
GITHUB_RELEASE_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}"