From 61442fd0c42060038e7948d425f1d763485240c1 Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Tue, 31 Jan 2023 16:42:27 +0100 Subject: [PATCH] feat: Improvement for CI --- .github/ISSUE_TEMPLATE/bug_report.md | 27 ------- .github/ISSUE_TEMPLATE/feature_request.md | 22 ------ .github/dependabot.yml | 7 -- .github/workflows/codeql.yml | 33 -------- .github/workflows/main.yml | 92 ----------------------- .goreleaser.yml | 19 +++-- build.Dockerfile | 6 ++ 7 files changed, 15 insertions(+), 191 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/main.yml create mode 100644 build.Dockerfile diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index f7757cdf..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Logs** -If applicable, add logs to help explain your problem. - -**Environment (please complete the following information):** - - OS: [e.g. ubuntu 20.04] - - Numary Version [e.g. 1.0.0-beta.4] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index b36319ba..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement, rfc -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Summary** - -**Solution proposal** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 99602049..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 773d9fba..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '35 21 * * 5' - -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 repository - uses: actions/checkout@v3 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 3416ff0a..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,92 +0,0 @@ -on: - push: - branches: - - 'main' - - 'features/**' - - 'feature/**' - - 'feat/**' - - 'fix/**' - - 'hotfix/**' - pull_request: - types: [ assigned, opened, synchronize, reopened ] - release: - types: [ prereleased, released ] - -name: Main -jobs: - pr-style: - if: github.event_name == 'pull_request' - uses: numary/gh-workflows/.github/workflows/pr-style.yml@main - - lint: - uses: numary/gh-workflows/.github/workflows/golang-lint.yml@main - - test: - uses: numary/gh-workflows/.github/workflows/golang-test.yml@main - - goreleaser-build: - if: github.event_name != 'release' - uses: numary/gh-workflows/.github/workflows/goreleaser-build.yml@main - needs: - - lint - - test - - goreleaser-release: - if: github.event_name == 'release' - uses: numary/gh-workflows/.github/workflows/goreleaser-release.yml@main - secrets: - FURY_TOKEN: ${{ secrets.FURY_TOKEN }} - NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} - needs: - - lint - - test - - docker-build-push: - runs-on: ubuntu-latest - needs: - - lint - - test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: 'go.mod' - cache: true - - run: go mod vendor - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: "NumaryBot" - password: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - if: github.event.action == 'released' - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/formancehq/payments:latest,ghcr.io/formancehq/payments:${{ github.event.release.tag_name }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=${{ github.event.release.tag_name }} - - if: github.event.action == 'prereleased' - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/formancehq/payments:${{ github.event.release.tag_name }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=${{ github.event.release.tag_name }} - - if: github.event.action != 'released' || github.event.action != 'prereleased' - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/formancehq/payments:${{ github.sha }} - build-args: | - APP_SHA=${{ github.sha }} - VERSION=develop diff --git a/.goreleaser.yml b/.goreleaser.yml index 11825562..8f25add6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -16,7 +16,6 @@ builds: - CGO_ENABLED=0 goos: - linux - - darwin goarch: - amd64 - arm64 @@ -67,8 +66,8 @@ release: dockers: - - image_templates: ["ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64"] - dockerfile: Dockerfile + - image_templates: ["ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-amd64"] + dockerfile: build.Dockerfile use: buildx build_flag_templates: - --platform=linux/amd64 @@ -80,9 +79,9 @@ dockers: - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=MIT - - image_templates: [ "ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64" ] + - image_templates: [ "ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-arm64" ] goarch: arm64 - dockerfile: Dockerfile + dockerfile: build.Dockerfile use: buildx build_flag_templates: - --platform=linux/arm64/v8 @@ -95,11 +94,11 @@ dockers: - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=MIT docker_manifests: - - name_template: ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }} + - name_template: ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }} image_templates: - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64 + - ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-amd64 + - ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-arm64 - name_template: ghcr.io/formancehq/{{ .ProjectName }}:latest image_templates: - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/formancehq/{{ .ProjectName }}:{{ .Version }}-arm64 + - ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-amd64 + - ghcr.io/formancehq/{{ .ProjectName }}:v{{ .Version }}-arm64 diff --git a/build.Dockerfile b/build.Dockerfile new file mode 100644 index 00000000..a3e341d4 --- /dev/null +++ b/build.Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:jammy +RUN apt update && apt install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* +COPY payments /usr/bin/payments +ENV OTEL_SERVICE_NAME payments +ENTRYPOINT ["/usr/bin/payments"] +CMD ["serve"]