Skip to content

Commit

Permalink
chore(ci): unify CI workflows (#172)
Browse files Browse the repository at this point in the history
Move build and linting jobs to a single GH workflow file.
It simplifies managing the settings for these jobs and
keeping them consistent.

Reduce permissions scope for ci workflow

Allow triggering when pushing to the 'main' branch
Run on pull requests on all branches
Build when pushing tags

Run Docker workflow on push to 'main' branch
Run Docker workflow on pull requests on all branches

Cleanups:
- rename workflow
- use consistent indentation for steps
- capitalize job name
  • Loading branch information
julio-lopez authored Sep 15, 2023
1 parent 3b14d38 commit f7a24bd
Showing 3 changed files with 43 additions and 44 deletions.
50 changes: 40 additions & 10 deletions .github/workflows/golangci-lint.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
name: Lint
name: CI

on:
push:
tags:
- v*
branches:
- master
- main
- main
- master
tags:
- v*

pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint

build:
name: Build
runs-on: ubuntu-latest
steps:
-
name: Check out code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
-
name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
id: go
-
name: Build
run: go build -v .
-
name: Test
run: go test -v ./...

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
-
name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Set up Go
-
name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
- name: golangci-lint
-
name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
7 changes: 3 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -2,15 +2,14 @@ name: Docker

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master
- main
- master

# Publish `v1.2.3` tags as releases.
tags:
- v*
- v*
pull_request:
branches: [ master ]

env:
REGISTRY: ghcr.io
30 changes: 0 additions & 30 deletions .github/workflows/go.yml

This file was deleted.

0 comments on commit f7a24bd

Please sign in to comment.