Skip to content

Commit a880879

Browse files
chore: Setup project boilerplate (#1)
* chore: Init golang package and base architecture * chore: Create basic github related files * ci: Setup integration and tagging pipelines * build: Create release pipeline
1 parent 049f60b commit a880879

File tree

18 files changed

+225
-0
lines changed

18 files changed

+225
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Global CODEOWNERS that will be requested for review when a new PR is opened
2+
* @PedroChaparro

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Includes 📋
2+
3+
<!-- What does this PR includes? Use bulleted list. -->
4+
5+
## Related Issues 🔎
6+
7+
<!-- What issues does this PR fix or reference? You may use "Closes #<issue number>" to automatically close the issue when this PR is merged. -->
8+
9+
## Notes 📝
10+
11+
<!-- Additional notes or implementation details. -->

.github/workflows/integration.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- dev
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-22.04
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: "1.21.5"
20+
21+
- name: Clean and build
22+
run: |
23+
go clean -cache
24+
go build .
25+
26+
lint:
27+
runs-on: ubuntu-22.04
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: Setup Go
33+
uses: actions/setup-go@v4
34+
with:
35+
go-version: "1.21.5"
36+
37+
- name: Lint
38+
run: test -z $(gofmt -l src/**/*)

.github/workflows/release.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/**"
9+
- "src/**"
10+
- "Dockerfile"
11+
- "version.json"
12+
- "main.go"
13+
- "go.mod"
14+
- "go.sum"
15+
16+
jobs:
17+
version:
18+
runs-on: ubuntu-22.04
19+
outputs:
20+
version: ${{ steps.version.outputs.version }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Install jq
25+
run: sudo apt install jq -y
26+
27+
- name: Get latest version
28+
id: version
29+
run: |
30+
chmod u+x ./version.sh
31+
./version.sh >> $GITHUB_OUTPUT
32+
33+
release:
34+
runs-on: ubuntu-22.04
35+
permissions:
36+
contents: write
37+
packages: write
38+
needs:
39+
- version
40+
outputs:
41+
upload_url: ${{ steps.release.outputs.upload_url }}
42+
steps:
43+
- name: Release
44+
id: release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: ${{ needs.version.outputs.version }}
50+
release_name: Release v${{ needs.version.outputs.version }}
51+
draft: false
52+
prerelease: false
53+
54+
docker:
55+
runs-on: ubuntu-22.04
56+
permissions:
57+
contents: read
58+
packages: write
59+
needs:
60+
- version
61+
- release
62+
steps:
63+
- uses: actions/checkout@v3
64+
65+
- name: Login
66+
uses: docker/login-action@v2
67+
with:
68+
registry: ghcr.io
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Build and push
73+
uses: docker/build-push-action@v3
74+
with:
75+
context: .
76+
push: true
77+
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.version.outputs.version }}

.github/workflows/tagging.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tagging
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
tagging:
10+
permissions:
11+
contents: write
12+
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- uses: TriPSs/conventional-changelog-action@v3
19+
name: Changelog
20+
id: changelog
21+
with:
22+
git-user-nane: "Pedro Andrés Chaparro Quintero"
23+
git-user-email: "62714297+PedroChaparro@users.noreply.github.com"
24+
git-message: "chore(release): {version}"
25+
version-file: "version.json"

.gitignore

Whitespace-only changes.

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -- Build --
2+
FROM docker.io/library/golang:1.21.5-alpine3.19 AS builder
3+
4+
# Install upx
5+
WORKDIR /source
6+
RUN apk --no-cache add git upx
7+
8+
# Install dependencies
9+
COPY go.mod go.sum ./
10+
RUN go mod download
11+
12+
# Copy source code and build
13+
COPY . .
14+
RUN go build -o /source/bin/artifact
15+
16+
# -- Run --
17+
FROM docker.io/library/alpine:3.18 AS runner
18+
19+
# Add non-root user
20+
RUN adduser -D -h /opt/codelabs -s /sbin/nologin codelabs
21+
WORKDIR /opt/codelabs
22+
USER codelabs
23+
24+
# Copy binary and run
25+
COPY --from=builder /source/bin/artifact /opt/codelabs/
26+
27+
# Run
28+
ENTRYPOINT ["/opt/codelabs/artifact"]

go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/upb-code-labs/submissions-status-updater-microservice
2+
3+
go 1.21.5
4+
5+
require (
6+
github.com/lib/pq v1.10.9 // indirect
7+
github.com/rabbitmq/amqp091-go v1.9.0 // indirect
8+
)

go.sum

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
4+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
5+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6+
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
7+
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
8+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9+
github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc3Aoo=
10+
github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
11+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
12+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
13+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
14+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
15+
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
16+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
17+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
18+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
19+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
fmt.Println("Implement me!")
7+
}

0 commit comments

Comments
 (0)