Skip to content

CI: Add macOS and Windows support #432

CI: Add macOS and Windows support

CI: Add macOS and Windows support #432

Workflow file for this run

on: [push, pull_request]
name: CI
env:
GO_VERSION: 1.21.x
jobs:
backend-psql:
name: GoCryptoTrader back-end
strategy:
matrix:
include:
- os: ubuntu-latest
goarch: amd64
psql: true
- os: ubuntu-latest
goarch: 386
psql: true
- os: macos-latest
goarch: amd64
psql: true
- os: macos-13 # beta
goarch: arm64
psql: false
- os: windows-latest
goarch: amd64
psql: true
runs-on: ${{ matrix.os }}
steps:
- name: Cancel previous workflow runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: ikalnytskyi/action-setup-postgres@v4
if: matrix.psql == 'true'
with:
database: gct_dev_ci
id: postgres
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
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: Additional steps for 386 architecture
if: matrix.goarch == '386'
run: |
echo "CGO_ENABLED=1" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib
shell: bash
- name: Cache go modules
uses: actions/cache@v3
with:
path: |
${{ env.GOMODCACHE }}
${{ env.GOCACHE }}
key: ${{ runner.os }}-go-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ matrix.goarch }}-
- name: Test
run: |
unset PGSERVICEFILE
if [ "${{ matrix.goarch }}" = "386" ]; then
go test -coverprofile coverage.txt -covermode atomic ./...
else
go test -race -coverprofile coverage.txt -covermode atomic ./...
fi
shell: bash
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
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
frontend:
name: GoCryptoTrader front-end
runs-on: ubuntu-latest
steps:
- name: Cancel previous workflow runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '10.8.x'
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Build
run: |
cd web/
npm install
npm run lint
npm run build