-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from Teamwork/docker
Docker build, switch to GHA
- Loading branch information
Showing
17 changed files
with
160 additions
and
1,762 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 |
---|---|---|
|
@@ -12,5 +12,5 @@ trim_trailing_whitespace = true | |
[*.{go,sh}] | ||
indent_style = tab | ||
|
||
[*.yaml] | ||
[*.{yaml,yml}] | ||
indent_size = 2 |
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,88 @@ | ||
name: Go | ||
on: [push] | ||
jobs: | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
only-new-issues: true | ||
|
||
|
||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.20" | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
path: gopath/src/github.com/teamwork/kommentaar | ||
|
||
- name: Test & coverage | ||
env: | ||
GO111MODULE: "off" | ||
GOPATH: ${{ github.workspace }}/gopath | ||
run: | | ||
cd $GOPATH/src/github.com/teamwork/kommentaar | ||
go test -coverprofile=full_coverage -race ./... | ||
- name: Upload coverage | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GOPATH: ${{ github.workspace }}/gopath | ||
run: | | ||
export PATH="$GOPATH/bin:$PATH" | ||
go install github.com/mattn/goveralls@latest | ||
cd $GOPATH/src/github.com/teamwork/kommentaar | ||
goveralls -coverprofile=full_coverage -service=github | ||
build: | ||
name: Build and push image | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
/coverage.html | ||
.DS_Store | ||
.idea | ||
*.coverage | ||
*_coverage |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
FROM golang:1.20-alpine | ||
|
||
VOLUME /code | ||
VOLUME /config | ||
VOLUME /output | ||
|
||
COPY . /go/src/github.com/teamwork/kommentaar | ||
COPY config.example /config/kommentaar.conf | ||
|
||
CMD ["/go/src/github.com/teamwork/kommentaar/run.sh"] |
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
Oops, something went wrong.