From ed0802d2bef5d1db1c9140e52876300cf2d1f738 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Fri, 6 Jan 2023 08:07:19 +0000 Subject: [PATCH] add: ci integration --- .deepsource.toml | 9 +++++++++ .github/dependabot.yaml | 6 ++++++ .github/workflows/release.yaml | 35 ++++++++++++++++++++++++++++++++++ .goreleaser | 33 ++++++++++++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 .deepsource.toml create mode 100644 .github/dependabot.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser create mode 100644 Dockerfile diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..57ec587 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,9 @@ +version = 1 + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_root = "github.com/grassrootseconomics/cic-custodial" + \ No newline at end of file diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..20e1ef1 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..85d0a3b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: goreleaser + +on: + push: + tags: + - "v*" + +jobs: + goreleaser: + runs-on: ubuntu-latest + environment: build + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19.3 + + - name: Login to Docker Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: --parallelism 1 --rm-dist --skip-validate + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser b/.goreleaser new file mode 100644 index 0000000..a2ccd47 --- /dev/null +++ b/.goreleaser @@ -0,0 +1,33 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + main: ./cmd + ldflags: + - -s -w + +archives: + - format: tar.gz + files: + - LICENSE + - config.toml + - queries.sql + - migrations/* + +dockers: + - goos: linux + goarch: amd64 + ids: + - cic-chain-events + image_templates: + - "ghcr.io/grassrootseconomics/cic-chain-events/cic-chain-events:latest" + - "ghcr.io/grassrootseconomics/cic-chain-events/cic-chain-events:{{ .Tag }}" + dockerfile: Dockerfile + extra_files: + - LICENSE + - config.toml + - queries.sql + - migrations/* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..be097a3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:11-slim + +RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /cic-chain-events + +COPY cic-chain-events . +COPY config.toml . +COPY queries.sql . +COPY LICENSE . +COPY migrations migrations/ + +CMD ["./cic-chain-events"]