-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump dependency version * use opentelemetry for enabling tracing * update codeowners file * bump github actions workflows
- Loading branch information
Showing
15 changed files
with
263 additions
and
819 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 +1,2 @@ | ||
* @aldy505 @elianiva @kokizzu | ||
* @teknologi-umum/backend-go | ||
.github/ @teknologi-umum/infrastructure |
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,41 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
schedule: | ||
- cron: "11 18 * * 6" | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ go ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
queries: +security-and-quality | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{ matrix.language }}" |
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 |
---|---|---|
|
@@ -10,25 +10,33 @@ env: | |
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
ci: | ||
name: CI | ||
scan: | ||
name: Secret scan | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: golang:1.20-bookworm | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Setup jq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: TruffleHog OSS | ||
uses: trufflesecurity/trufflehog@main | ||
with: | ||
path: ./ | ||
base: ${{ github.event.repository.default_branch }} | ||
head: HEAD | ||
extra_args: --debug --only-verified | ||
|
||
ci: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: golang:1.21 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
run: go build -buildvcs=false . | ||
|
||
|
@@ -39,14 +47,6 @@ jobs: | |
PORT: 3000 | ||
TZ: UTC | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: go | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 | ||
|
||
- uses: codecov/codecov-action@v3 | ||
|
||
release: | ||
|
@@ -62,16 +62,19 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
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@v4 | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
|
@@ -85,55 +88,9 @@ jobs: | |
org.opencontainers.image.authors=Teknologi Umum | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
cd: | ||
name: CD | ||
needs: | ||
- release | ||
runs-on: ubuntu-latest | ||
container: debian:bookworm | ||
timeout-minutes: 120 | ||
steps: | ||
- name: Install required packages | ||
run: apt-get update && apt-get upgrade -y && apt-get install -y git tar gzip curl ssh | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Register SSH key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_KEY }} | ||
name: id_ed25519 | ||
known_hosts: ${{ secrets.SSH_IP }} | ||
if_key_exists: replace | ||
|
||
- name: SSH Keyscan | ||
run: ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_IP }} >> /root/.ssh/known_hosts | ||
|
||
- name: Pull latest code | ||
run: > | ||
ssh | ||
-i /root/.ssh/id_ed25519 | ||
-p ${{ secrets.SSH_PORT }} | ||
-t ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} | ||
'ssh polarite "cd ${{ secrets.SSH_WORKDIR }}/polarite && git pull" ' | ||
- name: Create Sentry release | ||
uses: getsentry/action-release@v1 | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }} | ||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | ||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | ||
with: | ||
environment: production | ||
set_commits: skip | ||
version: ${{ github.sha }} |
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 |
---|---|---|
|
@@ -4,25 +4,33 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
ci: | ||
name: CI | ||
scan: | ||
name: Secret scan | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: golang:1.20-bookworm | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Setup jq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: TruffleHog OSS | ||
uses: trufflesecurity/trufflehog@main | ||
with: | ||
path: ./ | ||
base: ${{ github.event.repository.default_branch }} | ||
head: HEAD | ||
extra_args: --debug --only-verified | ||
|
||
ci: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: golang:1.21 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
run: go build -buildvcs=false . | ||
|
||
|
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
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
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
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,9 +1,15 @@ | ||
package controllers | ||
|
||
import "polarite/repository" | ||
import ( | ||
"polarite/repository" | ||
|
||
"go.opentelemetry.io/otel" | ||
) | ||
|
||
// Dependency injection struct. | ||
// Initialize once, use it everywhere. | ||
type Dependency struct { | ||
repository.Paste | ||
} | ||
|
||
var tracer = otel.Tracer("polarite") |
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.