do not check third party response when run tests in ci pipeline

This commit is contained in:
MaysWind
2025-07-02 22:17:25 +08:00
parent 3296d21f6a
commit 5400a1424c
7 changed files with 22 additions and 1 deletions
+2
View File
@@ -54,6 +54,8 @@ jobs:
push: true push: true
build-args: | build-args: |
RELEASE_BUILD=1 RELEASE_BUILD=1
BUILD_PIPELINE=1
CHECK_3RD_API=${{ vars.CHECK_3RD_API }}
SKIP_TESTS=${{ vars.SKIP_TESTS }} SKIP_TESTS=${{ vars.SKIP_TESTS }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
+3 -1
View File
@@ -53,6 +53,8 @@ jobs:
platforms: ${{ vars.BUILD_SNAPSHOT_PLATFORMS }} platforms: ${{ vars.BUILD_SNAPSHOT_PLATFORMS }}
push: true push: true
build-args: | build-args: |
SKIP_TESTS=${{ vars.SKIP_TESTS }} BUILD_PIPELINE=1
CHECK_3RD_API=${{ vars.CHECK_3RD_API }}
SKIP_TESTS=${{ vars.SKIP_TESTS }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
+2
View File
@@ -50,6 +50,8 @@ jobs:
push: true push: true
build-args: | build-args: |
RELEASE_BUILD=1 RELEASE_BUILD=1
BUILD_PIPELINE=1
CHECK_3RD_API=${{ vars.CHECK_3RD_API }}
SKIP_TESTS=${{ vars.SKIP_TESTS }} SKIP_TESTS=${{ vars.SKIP_TESTS }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
+2
View File
@@ -48,6 +48,8 @@ jobs:
linux/arm/v6 linux/arm/v6
push: true push: true
build-args: | build-args: |
BUILD_PIPELINE=1
CHECK_3RD_API=${{ vars.CHECK_3RD_API }}
SKIP_TESTS=${{ vars.SKIP_TESTS }} SKIP_TESTS=${{ vars.SKIP_TESTS }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@@ -27,4 +27,6 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
push: false push: false
build-args: | build-args: |
BUILD_PIPELINE=1
CHECK_3RD_API=${{ vars.CHECK_3RD_API }}
SKIP_TESTS=${{ vars.SKIP_TESTS }} SKIP_TESTS=${{ vars.SKIP_TESTS }}
+6
View File
@@ -1,8 +1,12 @@
# Build backend binary file # Build backend binary file
FROM golang:1.24.4-alpine3.22 AS be-builder FROM golang:1.24.4-alpine3.22 AS be-builder
ARG RELEASE_BUILD ARG RELEASE_BUILD
ARG BUILD_PIPELINE
ARG CHECK_3RD_API
ARG SKIP_TESTS ARG SKIP_TESTS
ENV RELEASE_BUILD=$RELEASE_BUILD ENV RELEASE_BUILD=$RELEASE_BUILD
ENV BUILD_PIPELINE=$BUILD_PIPELINE
ENV CHECK_3RD_API=$CHECK_3RD_API
ENV SKIP_TESTS=$SKIP_TESTS ENV SKIP_TESTS=$SKIP_TESTS
WORKDIR /go/src/github.com/mayswind/ezbookkeeping WORKDIR /go/src/github.com/mayswind/ezbookkeeping
COPY . . COPY . .
@@ -13,7 +17,9 @@ RUN ./build.sh backend
# Build frontend files # Build frontend files
FROM --platform=$BUILDPLATFORM node:22.16.0-alpine3.22 AS fe-builder FROM --platform=$BUILDPLATFORM node:22.16.0-alpine3.22 AS fe-builder
ARG RELEASE_BUILD ARG RELEASE_BUILD
ARG BUILD_PIPELINE
ENV RELEASE_BUILD=$RELEASE_BUILD ENV RELEASE_BUILD=$RELEASE_BUILD
ENV BUILD_PIPELINE=$BUILD_PIPELINE
WORKDIR /go/src/github.com/mayswind/ezbookkeeping WORKDIR /go/src/github.com/mayswind/ezbookkeeping
COPY . . COPY . .
RUN docker/frontend-build-pre-setup.sh RUN docker/frontend-build-pre-setup.sh
@@ -2,6 +2,7 @@ package exchangerates
import ( import (
"net/http/httptest" "net/http/httptest"
"os"
"testing" "testing"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@@ -310,6 +311,10 @@ func TestExchangeRatesApiLatestExchangeRateHandler_InternationalMonetaryFundData
} }
func executeLatestExchangeRateHandler(t *testing.T, dataSourceType string) *models.LatestExchangeRateResponse { func executeLatestExchangeRateHandler(t *testing.T, dataSourceType string) *models.LatestExchangeRateResponse {
if os.Getenv("BUILD_PIPELINE") == "1" && os.Getenv("CHECK_3RD_API") != "1" {
return nil
}
config := &settings.Config{ config := &settings.Config{
ExchangeRatesDataSource: dataSourceType, ExchangeRatesDataSource: dataSourceType,
ExchangeRatesRequestTimeout: 10000, ExchangeRatesRequestTimeout: 10000,