-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build Docker image and publish to GHCR | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ v* ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: hbtgmbh/air-pollution-service | ||
BUILD_ID: ${{github.run_number}} | ||
|
||
jobs: | ||
test: | ||
name: Test and lint | ||
uses: HBTGmbH/air-pollution-service/.github/workflows/test.yml@main | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Docker image | ||
run: docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_ID }} . | ||
|
||
- name: Push Docker image to Docker Hub | ||
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
name: Test | ||
on: [push] | ||
|
||
on: | ||
push: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [ '1.22.x' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
go-version: '1.22.x' | ||
|
||
- name: Install Dependencies | ||
run: go get ./... | ||
|
||
- name: Build | ||
run: go build ./... | ||
|
||
- name: Run tests | ||
run: go test ./... -json > TestResults-${{ matrix.go-version }}.json | ||
run: go test ./... -json > TestResults-.json | ||
|
||
- name: Upload test results | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ always() }} | ||
with: | ||
name: Go-results-${{ matrix.go-version }} | ||
path: TestResults-${{ matrix.go-version }}.json | ||
name: Go-results | ||
path: TestResults.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters