Skip to content

Commit

Permalink
Separate build from container workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Bock <[email protected]>
  • Loading branch information
nicolasbock committed Jul 10, 2024
1 parent 3bb5115 commit ecdd718
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 38 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dependency-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Repository'
- name: Checkout Repository
uses: actions/checkout@v4
- name: 'Dependency Review'

- name: Dependency Review
uses: actions/dependency-review-action@v4
19 changes: 5 additions & 14 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
name: Publish to Docker Hub

on:
schedule:
- cron: '31 13 * * *'
push:
branches: [ "main" ]
tags:
- 'v*.*.*' # v0.1.2
- 'v2*-*' # v20240613-1
pull_request:
branches: [ "main" ]
workflow_dispatch:
workflow_run:
workflows: [Build and Test]
types:
- completed

env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME || 'unpublished' }}

jobs:
build:

docker-publish:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -29,8 +22,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install cosign
if: github.event_name != 'pull_request'
Expand Down
29 changes: 9 additions & 20 deletions .github/workflows/ghcr-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
name: Docker publish (ghcr.io)

on:
schedule:
- cron: '38 11 * * *'
push:
branches: [ "main" ]
tags:
- 'v*.*.*' # v0.1.2
- 'v2*-*' # v20240613-1
pull_request:
branches: [ "main" ]
workflow_dispatch:
workflow_run:
workflows: [Build and Test]
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:

ghcr-publish:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -27,16 +20,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v5
- name: Get packages
uses: actions/donwload-artifact@v4
with:
go-version: "1.22"

- name: Test and Build
run: make all
name: packages
path: build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/issues.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Issues Sync

on:
issues:
types: opened

jobs:
sync-issues:
runs-on: ubuntu-latest

steps:
- uses: alex-page/[email protected]
with:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test-and-build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
name: Build and Test

on:
schedule:
- cron: '38 11 * * *'
push:
branches:
- main
tags:
- 'v*.*.*' # v0.1.2
- 'v2*-*' # v20240613-1
pull_request:
branches:
- main
workflow_dispatch:

name: Tests/Jobs for main branch merges
jobs:
test:
strategy:
Expand All @@ -28,3 +35,9 @@ jobs:

- name: Test and Build
run: make all

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: build/*
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: all
all: lint build test
all: lint build test install

.PHONY: docker-compose
docker-compose:
Expand Down Expand Up @@ -79,3 +79,9 @@ gofmt: check_modules
.PHONY: test
test:
go test -v ./...

.PHONY: install
install: build
rm -rf build
mkdir build
cp athena-monitor athena-processor build/

0 comments on commit ecdd718

Please sign in to comment.