CI, sonic: Replace backend-arm64 docker build with native GHA runner, disable sonic for arm64 (#1794)

* CI: Replace docker amd64 with native runner, switch Docker test arch to amd64

* tests: Remove spaces and new lines from test JSON timestamp fields

* builds: Disable sonic for arm64 due to OKX unmarshal issue

* nits: Improve Dockerfile comment and fix build tag
This commit is contained in:
Adrian Gallagher
2025-02-24 12:38:12 +11:00
committed by GitHub
parent 636adb8822
commit 744ee7c099
13 changed files with 48 additions and 56 deletions

View File

@@ -1,4 +1,7 @@
FROM arm64v8/golang:1.23
FROM golang:1.23-alpine
# Install GCC and musl-dev (needed for SQLite library)
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
@@ -7,6 +10,4 @@ RUN go mod download && go mod verify
COPY . /app
RUN go build
CMD ["go", "test", "./..."]

View File

@@ -3,8 +3,8 @@ name: CI
env:
GO_VERSION: 1.23.x
jobs:
backend-psql:
name: GoCryptoTrader back-end
backend:
name: GoCryptoTrader backend (${{ matrix.os }}, ${{ matrix.goarch }}, psql=${{ matrix.psql }}, skip_wrapper_tests=${{ matrix.skip_wrapper_tests}}, sonic=${{ matrix.sonic && matrix.goarch != '386' }})
strategy:
fail-fast: false
matrix:
@@ -18,17 +18,17 @@ jobs:
goarch: 386
psql: true
skip_wrapper_tests: true
sonic: true # sonic is disabled for 386 this ensures fall back to legacy code
sonic: true # Sonic is not supported on 386 systems, this ensures our build tag condition defaults to and tests the standard encoding/json implementation
- os: ubuntu-24.04-arm
goarch: arm64
psql: false # Not supported
skip_wrapper_tests: true
sonic: false # Disabled temporarily until OKX's unmarshalling is changed for sonic arm64 compatibility
- os: macos-latest
goarch: amd64
goarch: arm64
psql: true
skip_wrapper_tests: true
sonic: true
- os: macos-13 # beta
goarch: amd64
psql: true
skip_wrapper_tests: true
sonic: true
sonic: false # Same reason as the arm64 ubuntu-latest runner
- os: windows-latest
goarch: amd64
psql: true
@@ -38,7 +38,7 @@ jobs:
goarch: amd64
psql: true
skip_wrapper_tests: false
sonic: false
sonic: false # Disabled intentionally to test GCT's standard encoding/json implementation
runs-on: ${{ matrix.os }}
@@ -117,9 +117,9 @@ jobs:
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
backend-arm64:
name: GoCryptoTrader back-end (ubuntu-latest, arm64, false, true)
backend-docker:
name: GoCryptoTrader backend docker (ubuntu-latest, amd64, psql=false, skip_wrapper_tests=true, sonic=true)
runs-on: ubuntu-latest
steps:
@@ -130,11 +130,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
@@ -143,28 +138,27 @@ jobs:
uses: actions/cache@v4
with:
path: /tmp/.docker-buildx-cache
key: ${{ runner.os }}-docker-buildx-${{ hashFiles('./.github/workflows/arm64.Dockerfile') }}-${{ github.sha }}
key: ${{ runner.os }}-docker-buildx-${{ hashFiles('./.github/workflows/amd64.Dockerfile') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-buildx-${{ hashFiles('./.github/workflows/arm64.Dockerfile') }}-
${{ runner.os }}-docker-buildx-${{ hashFiles('./.github/workflows/amd64.Dockerfile') }}-
${{ runner.os }}-docker-buildx-
- name: Build Docker image
run: |
docker buildx build \
--load \
--platform linux/arm64 \
--cache-to=type=local,dest=/tmp/.docker-buildx-cache,mode=max \
--cache-from=type=local,src=/tmp/.docker-buildx-cache \
--tag gct-backend-arm64 \
-f ./.github/workflows/arm64.Dockerfile \
--tag gct-backend-amd64 \
-f ./.github/workflows/amd64.Dockerfile \
.
- name: Run Docker image
run: |
docker run --platform linux/arm64 --env SKIP_WRAPPER_CI_TESTS=true --env CI=true --env GCT_DOCKER_CI=true --rm gct-backend-arm64
docker run --env SKIP_WRAPPER_CI_TESTS=true --env CI=true --env GCT_DOCKER_CI=true --rm gct-backend-amd64
frontend:
name: GoCryptoTrader front-end
name: GoCryptoTrader frontend
runs-on: ubuntu-latest
steps:
- name: Cancel previous workflow runs