diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 413c22781..bdf1528a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,101 +9,101 @@ on: name: Main jobs: -# Pr: -# if: github.event_name == 'pull_request' -# uses: formancehq/gh-workflows/.github/workflows/pr-style.yml@main -# -# Test_postgres: -# name: 'Test with PostgreSQL' -# runs-on: ubuntu-latest -# steps: -# - name: Install task -# uses: arduino/setup-task@v1 -# with: -# repo-token: ${{ secrets.GITHUB_TOKEN }} -# - uses: actions/checkout@v3 -# - uses: actions/setup-go@v3 -# with: -# go-version-file: 'go.mod' -# cache: true -# - name: Run tests -# run: task tests -# - name: Upload coverage to Codecov -# uses: codecov/codecov-action@v3 -# with: -# fail_ci_if_error: false # optional (default = false) -# verbose: true # optional (default = false) -# -# Test_sqlite: -# uses: formancehq/gh-workflows/.github/workflows/golang-test.yml@main -# + Pr: + if: github.event_name == 'pull_request' + uses: formancehq/gh-workflows/.github/workflows/pr-style.yml@main + + Test_postgres: + name: 'Test with PostgreSQL' + runs-on: ubuntu-latest + steps: + - name: Install task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + cache: true + - name: Run tests + run: task tests + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false # optional (default = false) + verbose: true # optional (default = false) + + Test_sqlite: + uses: formancehq/gh-workflows/.github/workflows/golang-test.yml@main + Control: name: 'Control' uses: ./.github/workflows/template_build-control.yaml secrets: NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# -# GoReleaserBuild: -# needs: -# - Control -# - Test_sqlite -# - Test_postgres -# if: github.event_name != 'release' -# name: 'GoReleaser Build' -# uses: ./.github/workflows/template_goreleaser-build.yaml -# secrets: -# NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} -# -# GoReleaserRelease: -# needs: -# - Control -# - Test_sqlite -# - Test_postgres -# if: github.event_name == 'release' -# name: 'GoReleaser Release' -# uses: ./.github/workflows/template_goreleaser-release.yaml -# secrets: -# NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} -# FURY_TOKEN: ${{ secrets.FURY_TOKEN }} -# -# SdkGenerate: -# needs: -# - GoReleaserBuild -# uses: ./.github/workflows/template_sdk-generate.yaml -# secrets: -# NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# -# SdkPublish: -# needs: -# - GoReleaserRelease -# uses: ./.github/workflows/template_sdk-publish.yaml -# with: -# VERSION: ${{ github.event.release.tag_name }} -# secrets: -# NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# -# DockerRelease: -# needs: -# - Control -# - Test_sqlite -# - Test_postgres -# if: github.event_name == 'release' -# uses: ./.github/workflows/template_docker.yaml -# with: -# VERSION: ${{ github.event.release.tag_name }} -# APP_SHA: ${{ github.sha }} -# RELEASE: ${{ github.event.action }} -# secrets: -# NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} -# SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + + GoReleaserBuild: + needs: + - Control + - Test_sqlite + - Test_postgres + if: github.event_name != 'release' + name: 'GoReleaser Build' + uses: ./.github/workflows/template_goreleaser-build.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + + GoReleaserRelease: + needs: + - Control + - Test_sqlite + - Test_postgres + if: github.event_name == 'release' + name: 'GoReleaser Release' + uses: ./.github/workflows/template_goreleaser-release.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} + + SdkGenerate: + needs: + - GoReleaserBuild + uses: ./.github/workflows/template_sdk-generate.yaml + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + + SdkPublish: + needs: + - GoReleaserRelease + uses: ./.github/workflows/template_sdk-publish.yaml + with: + VERSION: ${{ github.event.release.tag_name }} + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + + DockerRelease: + needs: + - Control + - Test_sqlite + - Test_postgres + if: github.event_name == 'release' + uses: ./.github/workflows/template_docker.yaml + with: + VERSION: ${{ github.event.release.tag_name }} + APP_SHA: ${{ github.sha }} + RELEASE: ${{ github.event.action }} + secrets: + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} + SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }} DockerBranch: -# needs: -# - Control -# - Test_sqlite -# - Test_postgres + needs: + - Control + - Test_sqlite + - Test_postgres if: github.event_name != 'release' uses: ./.github/workflows/template_docker.yaml with: