diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7435c213..e08e2677 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,18 +50,6 @@ jobs: with: fetch-depth: 1 - - name: Build API documentation - working-directory: docs - run: | - make - tar -zcf ../api_docs.tar.gz * - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: api-docs - path: api_docs.tar.gz - build_release: runs-on: ubuntu-latest @@ -116,21 +104,6 @@ jobs: with: fetch-depth: 1 - - name: Set up workflow env - run: | - TOOLCHAIN=$(jq ".[\"${{ matrix.target_id }}\"].toolchain" -r < .github/build/database.json) - echo "TOOLCHAIN=$TOOLCHAIN" >> $GITHUB_ENV - GOOS=$(jq ".[\"${{ matrix.target_id }}\"].goos" -r < .github/build/database.json) - echo "GOOS=$GOOS" >> $GITHUB_ENV - GOARCH=$(jq ".[\"${{ matrix.target_id }}\"].goarch" -r < .github/build/database.json) - echo "GOARCH=$GOARCH" >> $GITHUB_ENV - GOARM=$(jq ".[\"${{ matrix.target_id }}\"].goarm" -r < .github/build/database.json) - echo "GOARM=$GOARM" >> $GITHUB_ENV - GOMIPS=$(jq ".[\"${{ matrix.target_id }}\"].gomips" -r < .github/build/database.json) - echo "GOMIPS=$GOMIPS" >> $GITHUB_ENV - RELEASE_NAME=$(jq ".[\"${{ matrix.target_id }}\"].name" -r < .github/build/database.json) - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - - name: Set up Golang uses: actions/setup-go@v5 with: @@ -150,17 +123,24 @@ jobs: tar -zxf frontend_dist.tar.gz rm -f frontend_dist.tar.gz - - name: Download documentation artifacts - uses: actions/download-artifact@v4 - with: - name: api-docs - path: docs + - name: Build API documentation + run: | + make docs - - name: Extract documentation artifacts - working-directory: docs + - name: Set up workflow env run: | - tar -zxf api_docs.tar.gz - rm -f api_docs.tar.gz + TOOLCHAIN=$(jq ".[\"${{ matrix.target_id }}\"].toolchain" -r < .github/build/database.json) + echo "TOOLCHAIN=$TOOLCHAIN" >> $GITHUB_ENV + GOOS=$(jq ".[\"${{ matrix.target_id }}\"].goos" -r < .github/build/database.json) + echo "GOOS=$GOOS" >> $GITHUB_ENV + GOARCH=$(jq ".[\"${{ matrix.target_id }}\"].goarch" -r < .github/build/database.json) + echo "GOARCH=$GOARCH" >> $GITHUB_ENV + GOARM=$(jq ".[\"${{ matrix.target_id }}\"].goarm" -r < .github/build/database.json) + echo "GOARM=$GOARM" >> $GITHUB_ENV + GOMIPS=$(jq ".[\"${{ matrix.target_id }}\"].gomips" -r < .github/build/database.json) + echo "GOMIPS=$GOMIPS" >> $GITHUB_ENV + RELEASE_NAME=$(jq ".[\"${{ matrix.target_id }}\"].name" -r < .github/build/database.json) + echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - name: Build core application run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index c5f1b61a..3d4f946d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ Starting from v2.2.5, all notable changes to this project will be documented in this file. +## v3.2.4 + +### CI/CD Changes + +- Merge API docs Makefile into the main Makefile. +- Add support for OpenBSD builds. + +### New Features + +- Add SQLite support on all architectures. +- Provide i18n support for earthquake event data source. +- Show flags next to earthquake data sources. + ## v3.2.3 ### CI/CD Changes diff --git a/Dockerfile b/Dockerfile index e587927b..06a9e015 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,10 +23,10 @@ FROM golang:alpine AS builder # ENV GOPROXY="https://goproxy.cn,direct" COPY . /build_src COPY --from=frontend /build_src/frontend/dist /build_src/frontend/dist -WORKDIR /build_src/docs +WORKDIR /build_src RUN go get -v github.com/swaggo/swag/cmd/swag \ && go install -v github.com/swaggo/swag/cmd/swag \ - && swag init -g ../cmd/main.go -d ../api,../config,../drivers/explorer,../server -o ./ + && swag init -d ./ -o ./docs -g ./cmd/main.go WORKDIR /build_src/cmd RUN CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$(cat ../VERSION) -X main.tag=dockerbuild" \ -v -trimpath \ diff --git a/Makefile b/Makefile index 6f55c3ea..feb88893 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build digest clean run gen +.PHONY: build digest clean run docs gen BINARY=observer ifeq (${GOOS}, windows) @@ -44,6 +44,14 @@ clean: @echo "[Warn] Cleaning up project..." @rm -rf $(DIST_DIR)/* +docs: +ifeq ($(shell command -v swag 2> /dev/null),) + @echo "Installing Swagger..." + @go get github.com/swaggo/swag/cmd/swag + @go install github.com/swaggo/swag/cmd/swag +endif + @swag init -d ./ -o ./docs -g ./cmd/main.go + gen: ifeq ($(shell command -v gqlgen 2> /dev/null),) @echo "[Info] Installing gqlgen..." diff --git a/VERSION b/VERSION index 51033692..293fbd1e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.2.3 +v3.2.4 diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 0c1a7c52..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: build - -build: -ifeq ($(shell command -v swag 2> /dev/null),) - @echo "Installing Swagger..." - @go get github.com/swaggo/swag/cmd/swag - @go install github.com/swaggo/swag/cmd/swag -endif - @swag init -g ../cmd/main.go -d ../api,../config,../drivers/explorer,../server -o ./ diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 55e42be3..00000000 --- a/docs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Generate Docs by Swagger - -Please refer to [Build From Source](https://anyshake.org/docs/AnyShake%20Observer/Development/src-build#build-docs). diff --git a/docs/docs.go b/docs/docs.go index ca2ada33..8f828a14 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -267,7 +267,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/trace.seismicEvent" + "$ref": "#/definitions/seisevent.Event" } } } @@ -423,6 +423,52 @@ const docTemplate = `{ } } }, + "seisevent.Estimation": { + "type": "object", + "properties": { + "p": { + "type": "number" + }, + "s": { + "type": "number" + } + } + }, + "seisevent.Event": { + "type": "object", + "properties": { + "depth": { + "type": "number" + }, + "distance": { + "type": "number" + }, + "estimation": { + "$ref": "#/definitions/seisevent.Estimation" + }, + "event": { + "type": "string" + }, + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + }, + "magnitude": { + "type": "number" + }, + "region": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "verfied": { + "type": "boolean" + } + } + }, "station.cpuInfo": { "type": "object", "properties": { @@ -548,52 +594,6 @@ const docTemplate = `{ "$ref": "#/definitions/config.Stream" } } - }, - "trace.seismicEvent": { - "type": "object", - "properties": { - "depth": { - "type": "number" - }, - "distance": { - "type": "number" - }, - "estimation": { - "$ref": "#/definitions/trace.seismicEventEstimation" - }, - "event": { - "type": "string" - }, - "latitude": { - "type": "number" - }, - "longitude": { - "type": "number" - }, - "magnitude": { - "type": "number" - }, - "region": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "verfied": { - "type": "boolean" - } - } - }, - "trace.seismicEventEstimation": { - "type": "object", - "properties": { - "p": { - "type": "number" - }, - "s": { - "type": "number" - } - } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index ad047489..5c044651 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -259,7 +259,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/trace.seismicEvent" + "$ref": "#/definitions/seisevent.Event" } } } @@ -415,6 +415,52 @@ } } }, + "seisevent.Estimation": { + "type": "object", + "properties": { + "p": { + "type": "number" + }, + "s": { + "type": "number" + } + } + }, + "seisevent.Event": { + "type": "object", + "properties": { + "depth": { + "type": "number" + }, + "distance": { + "type": "number" + }, + "estimation": { + "$ref": "#/definitions/seisevent.Estimation" + }, + "event": { + "type": "string" + }, + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + }, + "magnitude": { + "type": "number" + }, + "region": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "verfied": { + "type": "boolean" + } + } + }, "station.cpuInfo": { "type": "object", "properties": { @@ -540,52 +586,6 @@ "$ref": "#/definitions/config.Stream" } } - }, - "trace.seismicEvent": { - "type": "object", - "properties": { - "depth": { - "type": "number" - }, - "distance": { - "type": "number" - }, - "estimation": { - "$ref": "#/definitions/trace.seismicEventEstimation" - }, - "event": { - "type": "string" - }, - "latitude": { - "type": "number" - }, - "longitude": { - "type": "number" - }, - "magnitude": { - "type": "number" - }, - "region": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "verfied": { - "type": "boolean" - } - } - }, - "trace.seismicEventEstimation": { - "type": "object", - "properties": { - "p": { - "type": "number" - }, - "s": { - "type": "number" - } - } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 74898a78..085c6050 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -87,6 +87,36 @@ definitions: time: type: string type: object + seisevent.Estimation: + properties: + p: + type: number + s: + type: number + type: object + seisevent.Event: + properties: + depth: + type: number + distance: + type: number + estimation: + $ref: '#/definitions/seisevent.Estimation' + event: + type: string + latitude: + type: number + longitude: + type: number + magnitude: + type: number + region: + type: string + timestamp: + type: integer + verfied: + type: boolean + type: object station.cpuInfo: properties: model: @@ -169,36 +199,6 @@ definitions: stream: $ref: '#/definitions/config.Stream' type: object - trace.seismicEvent: - properties: - depth: - type: number - distance: - type: number - estimation: - $ref: '#/definitions/trace.seismicEventEstimation' - event: - type: string - latitude: - type: number - longitude: - type: number - magnitude: - type: number - region: - type: string - timestamp: - type: integer - verfied: - type: boolean - type: object - trace.seismicEventEstimation: - properties: - p: - type: number - s: - type: number - type: object info: contact: {} description: This is APIv1 documentation for AnyShake Observer, please set `server_settings.debug` @@ -375,7 +375,7 @@ paths: - properties: data: items: - $ref: '#/definitions/trace.seismicEvent' + $ref: '#/definitions/seisevent.Event' type: array type: object "400":