-
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.
* Promote the `dump` command to a first class CLI * Remove unused images * Migrate to Github Actions --------- Co-authored-by: Nick Schuch <nick@myschuch.com>
- Loading branch information
1 parent
95e46c4
commit 6952378
Showing
746 changed files
with
244,138 additions
and
14,908 deletions.
There are no files selected for viewing
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,16 @@ | ||
name: Lint | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.21' | ||
- uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout=5m |
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,42 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,14 @@ | ||
name: Test | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.21' | ||
- run: go test ./... |
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 @@ | ||
.idea | ||
/bin |
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,14 @@ | ||
FROM golang:1.21 as build | ||
|
||
WORKDIR /go/src/github.com/skpr/mtk | ||
COPY . /go/src/github.com/skpr/mtk | ||
|
||
ENV CGO_ENABLED=0 | ||
|
||
RUN go build -o bin/mtk -ldflags='-extldflags "-static"' github.com/skpr/mtk/cmd/mtk | ||
|
||
FROM alpine:3.18 | ||
|
||
COPY --from=build /go/src/github.com/skpr/mtk/bin/mtk /usr/local/bin/mtk | ||
|
||
ENTRYPOINT ["/usr/local/bin/mtk"] |
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,45 +1,24 @@ | ||
#!/usr/bin/make -f | ||
|
||
IMAGE_REPO_BASE=skpr/mtk | ||
ARCH=amd64 | ||
VERSION_TAG=v2-latest | ||
export CGO_ENABLED=0 | ||
|
||
define build_image | ||
docker build --build-arg ARCH=${ARCH} -t ${IMAGE_REPO_BASE}-${1}:${VERSION_TAG}-${ARCH} ${1} | ||
endef | ||
|
||
define test_image | ||
container-structure-test test --image ${IMAGE_REPO_BASE}-${1}:${VERSION_TAG}-${ARCH} --config ${1}/tests.yml | ||
endef | ||
|
||
define push_image | ||
docker push ${IMAGE_REPO_BASE}-${1}:${VERSION_TAG}-${ARCH} | ||
endef | ||
|
||
define manifest | ||
$(eval IMAGE=${IMAGE_REPO_BASE}-${1}:${VERSION_TAG}) | ||
docker manifest create ${IMAGE} --amend ${IMAGE}-arm64 --amend ${IMAGE}-amd64 | ||
docker manifest push ${IMAGE} | ||
define build_step | ||
GOOS=$(1) GOARCH=$(2) go build -o bin/mtk-$(1)-$(2) -ldflags='-extldflags "-static"' github.com/skpr/mtk/cmd/mtk | ||
endef | ||
|
||
# Builds the project. | ||
build: | ||
$(call build_image,build) | ||
$(call build_image,mysql) | ||
$(call build_image,dump) | ||
|
||
test: | ||
$(call test_image,build) | ||
$(call test_image,mysql) | ||
$(call test_image,dump) | ||
$(call build_step,linux,amd64) | ||
$(call build_step,linux,arm64) | ||
$(call build_step,darwin,amd64) | ||
$(call build_step,darwin,arm64) | ||
|
||
push: | ||
$(call push_image,build) | ||
$(call push_image,mysql) | ||
$(call push_image,dump) | ||
# Run all lint checking with exit codes for CI. | ||
lint: | ||
golint -set_exit_status `go list ./... | grep -v /vendor/` | ||
|
||
manifest: | ||
$(call manifest,build) | ||
$(call manifest,mysql) | ||
$(call manifest,dump) | ||
# Run tests with coverage reporting. | ||
test: | ||
go test -cover ./... | ||
|
||
.PHONY: * |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.