This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5329ac4
commit 6c97a10
Showing
8 changed files
with
72 additions
and
44 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
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 |
---|---|---|
|
@@ -15,3 +15,6 @@ | |
|
||
# Generated by Go coverage. | ||
*.out | ||
|
||
# Generated by GoReleaser. | ||
dist/ |
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,11 @@ | ||
version: 1 | ||
|
||
builds: | ||
- id: starling-bank-technical-challenge | ||
main: ./cmd/starling-bank-technical-challenge | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ COPY_CI_DATA: | |
COMMAND | ||
COPY "./ci" "./ci" | ||
COPY ".github" ".github" | ||
COPY ".goreleaser.yaml" ".goreleaser.yaml" | ||
|
||
|
||
COPY_METADATA: | ||
|
@@ -56,12 +57,6 @@ COPY_SOURCECODE: | |
COPY "./api" "./api" | ||
|
||
|
||
SAVE_OUTPUT: | ||
COMMAND | ||
SAVE ARTIFACT "starling-bank-technical-challenge" AS LOCAL "starling-bank-technical-challenge" | ||
SAVE ARTIFACT "go.sum" AS LOCAL "go.sum" | ||
|
||
|
||
golang-base: | ||
FROM golang:1.20.4 | ||
WORKDIR /tmp/starling-bank-technical-challenge | ||
|
@@ -80,7 +75,7 @@ check-go-formatting: | |
|
||
sh-formatting-base: | ||
FROM golang | ||
RUN go install mvdan.cc/sh/v3/cmd/[email protected] | ||
RUN go install mvdan.cc/sh/v3/cmd/[email protected] | ||
DO +COPY_CI_DATA | ||
|
||
|
||
|
@@ -91,7 +86,7 @@ check-shell-formatting: | |
|
||
yaml-formatting-base: | ||
FROM golang | ||
RUN go install github.com/google/yamlfmt/cmd/[email protected] | ||
RUN go install github.com/google/yamlfmt/cmd/[email protected] | ||
COPY ".yamlfmt" ".yamlfmt" | ||
DO +COPY_CI_DATA | ||
|
||
|
@@ -183,21 +178,22 @@ fix-modules: | |
SAVE ARTIFACT "go.sum" AS LOCAL "go.sum" | ||
|
||
|
||
compile-linux-amd64: | ||
FROM +golang-base | ||
DO +INSTALL_DEPENDENCIES | ||
DO +COPY_SOURCECODE | ||
RUN ./ci/compile.sh | ||
DO +SAVE_OUTPUT | ||
INSTALL_GORELEASER: | ||
COMMAND | ||
ENV GORELEASER_VERSION=1.22.1 | ||
RUN wget "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz" | ||
RUN tar -xzvf "goreleaser_Linux_x86_64.tar.gz" | ||
RUN cp "goreleaser" /bin/goreleaser | ||
|
||
|
||
compile-darwin-amd64: | ||
compile: | ||
FROM +golang-base | ||
ENV GOOS=darwin | ||
DO +INSTALL_GORELEASER | ||
DO +INSTALL_DEPENDENCIES | ||
DO +COPY_SOURCECODE | ||
RUN ./ci/compile.sh | ||
DO +SAVE_OUTPUT | ||
SAVE ARTIFACT "dist" AS LOCAL "dist" | ||
SAVE ARTIFACT "go.sum" AS LOCAL "go.sum" | ||
|
||
|
||
unit-test: | ||
|
@@ -207,18 +203,35 @@ unit-test: | |
RUN ./ci/unit-test.sh | ||
|
||
|
||
release: | ||
FROM +ubuntu-base | ||
RUN apt-get install wget git -y | ||
# Install GitHub CLI. | ||
ENV GH_VERSION=2.30.0 | ||
RUN wget "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz" | ||
RUN tar -xzvf "gh_${GH_VERSION}_linux_amd64.tar.gz" | ||
RUN cp "./gh_${GH_VERSION}_linux_amd64/bin/gh" /bin/gh | ||
# Install Git Cliff. | ||
INSTALL_GITHUB_CLI: | ||
COMMAND | ||
ENV GITHUB_CLI_VERSION=2.30.0 | ||
RUN wget "https://github.com/cli/cli/releases/download/v${GITHUB_CLI_VERSION}/gh_${GITHUB_CLI_VERSION}_linux_amd64.tar.gz" | ||
RUN tar -xzvf "gh_${GITHUB_CLI_VERSION}_linux_amd64.tar.gz" | ||
RUN cp "./gh_${GITHUB_CLI_VERSION}_linux_amd64/bin/gh" /bin/gh | ||
|
||
|
||
INSTALL_GIT_CLIFF: | ||
COMMAND | ||
ENV GIT_CLIFF_VERSION=1.2.0 | ||
RUN wget "https://github.com/orhun/git-cliff/releases/download/v${GIT_CLIFF_VERSION}/git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | ||
RUN tar -xzvf "git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | ||
RUN cp "./git-cliff-${GIT_CLIFF_VERSION}/git-cliff" /bin/git-cliff | ||
|
||
|
||
release: | ||
FROM +ubuntu-base | ||
RUN apt-get install wget git -y | ||
DO +INSTALL_GITHUB_CLI | ||
DO +INSTALL_GIT_CLIFF | ||
DO +COPY_METADATA | ||
RUN --secret GH_TOKEN ./ci/release.sh | ||
|
||
|
||
release-artifacts: | ||
FROM +ubuntu-base | ||
RUN apt-get install wget jq -y | ||
DO +INSTALL_GITHUB_CLI | ||
COPY +compile/dist ./dist | ||
DO +COPY_CI_DATA | ||
RUN --secret GH_TOKEN ./ci/release-artifacts.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
#!/usr/bin/env sh | ||
|
||
set -o errexit | ||
set -o xtrace | ||
|
||
yamlfmt -lint -dstar .github/**/* | ||
yamlfmt -lint -dstar .github/**/* .goreleaser.yaml |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
set -o errexit | ||
set -o xtrace | ||
|
||
yamlfmt -dstar ./github/**/* | ||
yamlfmt -dstar ./github/**/* .goreleaser.yaml |
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,11 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -o errexit | ||
set -o xtrace | ||
|
||
for row in $(jq -c '.[]' "dist/artifacts.json"); do | ||
path=$(echo "${row}" | jq -r '.path') | ||
name=$(echo "${path}" | cut -d '/' -f 2) | ||
|
||
echo "gh release upload TAG ${path}%#%${name}" | ||
done |