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

fix(gha): only push images on merge/release #180

Merged
merged 1 commit into from
Dec 31, 2024
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
21 changes: 21 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint and run tests

description: Lints and runs tests on the codebase, used before builds and on every PR

runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.23
- name: Lint the codebase
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: -E goimports -E godot --timeout 10m
- name: Run tests
shell: bash
run: |
PICO_SECRET="danger" go test -v ./... -cover -race -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out
18 changes: 2 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
- main
tags:
- v*
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
Expand All @@ -21,21 +18,10 @@ jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.23
- name: Checkout repo
uses: actions/checkout@v3
- name: Lint the codebase
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: -E goimports -E godot --timeout 10m
- name: Run tests
run: |
PICO_SECRET="danger" go test -v ./... -cover -race -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out
- name: Run tests and lint
uses: ./.github/actions/test
build-main:
runs-on: ubuntu-22.04
needs: test
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test PRs

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Run tests and lint
uses: ./.github/actions/test