Skip to content

Commit

Permalink
Seed commit 🌱
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJoiner committed Oct 29, 2024
0 parents commit 47811e3
Show file tree
Hide file tree
Showing 42 changed files with 4,342 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @KevinJoiner
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
groups:
go-mod:
patterns:
- "*"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
41 changes: 41 additions & 0 deletions .github/workflows/buildpushdev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: buildpushdev
on:
push:
branches:
- main
jobs:
build:
name: buildpushdev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: dimozone/fetch-api:${{ steps.slug.outputs.sha7 }}, dimozone/fetch-api:latest

- name: Update Image Version in the worker HelmChart values.yaml
uses: fjogeleit/yaml-update-action@master
with:
valueFile: "charts/fetch-api/values.yaml"
propertyPath: "image.tag"
value: ${{ steps.slug.outputs.sha7 }}
branch: main
message: "Update Image Version to ${{ steps.slug.outputs.sha7 }}"
47 changes: 47 additions & 0 deletions .github/workflows/buildpushtagged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: buildpush
on:
push:
tags:
- v*

jobs:
build_test:
# The type of runner that the job will run on
name: buildpush
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64
tags: dimozone/fetch-api:${{steps.tag.outputs.tag}}

- name: Update Image Version in the related HelmChart values.yaml
uses: fjogeleit/yaml-update-action@v0.11.1
with:
valueFile: "charts/fetch-api/values-prod.yaml"
propertyPath: "image.tag"
value: ${{steps.tag.outputs.tag}}
branch: main
message: "Update Image Version to ${{steps.tag.outputs.tag}}"
42 changes: 42 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: generate files
on:
pull_request:
branches: ["**"]
push:
branches:
- main

jobs:
generate:
# Condition to skip merge commits
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
runs-on: ubuntu-latest

name: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: go mod tidy
run: go mod tidy

- name: go mod verify
run: go mod verify

- name: install tools
run: make tools

- name: generate graphql files
run: make generate

- name: porcelain
shell: bash
run: |
dirty_files="$(git status --porcelain)"
if [[ `git status --porcelain` ]]; then
echo "The following files are dirty after running generators:"
echo "${dirty_files}"
exit 1
fi
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: lint
on:
pull_request:
branches: ["**"]
push:
branches:
- main
jobs:
lint:
# Condition to skip merge commits
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
runs-on: ubuntu-latest

name: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Install golangci-lint
run: make tools-golangci-lint

- name: Run golangci-lint
run: make lint
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test
on:
pull_request:
branches: ["**"]
push:
branches:
- main
jobs:
test:
# Condition to skip merge commits
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
runs-on: ubuntu-latest

name: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: mod verify
run: go mod verify

- name: Run Tests
run: make test
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test
bin/
__debug_bin*
*.DS_Store

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
settings.yaml

.idea
.vscode/
__debug_bin*
*.code-workspace
.history/


23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.22 AS build

RUN useradd -u 10001 dimo

WORKDIR /build
COPY . ./

RUN make tidy
RUN make build

FROM gcr.io/distroless/static AS final

LABEL maintainer="DIMO <hello@dimo.zone>"

USER nonroot:nonroot

COPY --from=build --chown=nonroot:nonroot /build/bin/fetch-api /

EXPOSE 8080
EXPOSE 8888

ENTRYPOINT ["/fetch-api"]

Loading

0 comments on commit 47811e3

Please sign in to comment.