forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
31 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,80 +5,34 @@ env: | |
jobs: | ||
backend-psql: | ||
name: GoCryptoTrader back-end with PSQL | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_DB: gct_dev_ci | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
goarch: amd64 | ||
- os: ubuntu-latest | ||
goarch: 386 | ||
- os: macos-latest | ||
goarch: arm64 | ||
- os: windows-latest | ||
goarch: amd64 | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Cancel previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
- uses: ikalnytskyi/action-setup-postgres@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
database: gct_dev_ci | ||
id: postgres | ||
|
||
- name: Cache go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
|
||
- name: Test | ||
run: go test -race -coverprofile coverage.txt -covermode atomic ./... | ||
env: | ||
PSQL_USER: postgres | ||
PSQL_PASS: postgres | ||
PSQL_HOST: localhost | ||
PSQL_DBNAME: gct_dev_ci | ||
PSQL_SKIPSQLCMD: true | ||
PSQL_TESTDBNAME: gct_dev_ci | ||
PSQL_SSLMODE: disable | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
|
||
backend-32bit: | ||
name: GoCryptoTrader back-end 32-bit with PSQL | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_DB: gct_dev_ci | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- name: Cancel previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Clear PGSERVICEFILE | ||
run: | | ||
echo "PGSERVICEFILE=" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -88,34 +42,32 @@ jobs: | |
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up Go environment | ||
run: | | ||
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV | ||
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Cache go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-386-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-386- | ||
|
||
- name: Update apt-get | ||
run: sudo apt-get update | ||
|
||
- name: Install gcc-multilib | ||
run: sudo apt-get install gcc-multilib | ||
${{ env.GOMODCACHE }} | ||
${{ env.GOCACHE }} | ||
key: ${{ runner.os }}-go-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go-${{ matrix.goarch }}- | ||
|
||
- name: Test | ||
run: go test -coverprofile coverage.txt -covermode atomic ./... | ||
run: go test -race -coverprofile coverage.txt -covermode atomic ./... | ||
env: | ||
GOARCH: ${{ matrix.goarch }} | ||
PSQL_USER: postgres | ||
PSQL_PASS: postgres | ||
PSQL_HOST: localhost | ||
PSQL_DBNAME: gct_dev_ci | ||
PSQL_SKIPSQLCMD: true | ||
PSQL_TESTDBNAME: gct_dev_ci | ||
PSQL_SSLMODE: disable | ||
GOARCH: 386 | ||
CGO_ENABLED: 1 | ||
CGO_CFLAGS: -fno-stack-protector | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
|