From 12c62cb2ec0e675da090b0c6b56775e289263f45 Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Mon, 27 Jun 2022 19:32:28 +0200 Subject: [PATCH] ci: GoReleaser & Run Test for every Release --- .github/workflows/release.yml | 87 +++++++++++++++++++++++++++++++++++ .goreleaser.yml | 4 +- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 094e7a089..d4762761e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,90 @@ on: permissions: contents: write jobs: + Test_sqlite: + name: 'Test - SQLite' + runs-on: ubuntu-latest + needs: + - build_control + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.18' + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: get deps + run: go mod download + - name: fetch numary control + uses: actions/download-artifact@v2 + with: + name: control-dist + path: cmd/control/ + - name: run tests + run: go test -tags json1 -v -coverpkg ./... -coverprofile coverage.out -covermode atomic ./... + Test_postgres: + name: 'Test - PostgreSQL' + runs-on: ubuntu-latest + needs: + - build_control + services: + postgres: + image: postgres:13-alpine + env: + POSTGRES_USER: ledger + POSTGRES_PASSWORD: ledger + POSTGRES_DB: ledger + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.18' + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: get deps + run: go mod download + - name: fetch numary control + uses: actions/download-artifact@v2 + with: + name: control-dist + path: cmd/control/ + - name: run tests + run: go test -tags json1 -v -coverpkg ./... -coverprofile coverage.out -covermode atomic ./... + env: + NUMARY_STORAGE_DRIVER: "postgres" + NUMARY_STORAGE_POSTGRES_CONN_STRING: "postgresql://ledger:ledger@127.0.0.1/ledger" + Lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: -v --timeout 10m -E gofmt,gci build_control: name: 'Build Control' runs-on: ubuntu-latest @@ -27,6 +111,9 @@ jobs: name: 'Build Binary' needs: - build_control + - Test_sqlite + - Test_postgres + - Lint runs-on: ubuntu-latest steps: - uses: actions/setup-go@v2 diff --git a/.goreleaser.yml b/.goreleaser.yml index 357ef6f75..42477c397 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -111,7 +111,7 @@ changelog: release: prerelease: auto footer: | - **Full Changelog**: https://github.com/numary/ledger/compare/{{ .PreviousTag }}...{{ .Tag }} + **Full Changelog**: https://docs.formance.com/oss/ledger/changelog/{{ .Tag }} ## What to do next? - Read the [documentation](https://docs.numary.com/oss/ledger/get-started/installation) - Join our [Discord server](https://discord.gg/xyHvcbzk4w) @@ -123,7 +123,7 @@ brews: name: numary folder: Formula homepage: https://numary.com - skip_upload: false + skip_upload: auto test: | system "#{bin}/numary version" install: |