Skip to content

Commit

Permalink
build: Merge API docs Makefile into the main Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Sep 5, 2024
1 parent e81a8b5 commit 2569df3
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 177 deletions.
52 changes: 16 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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: |
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build digest clean run gen
.PHONY: build digest clean run docs gen

BINARY=observer
ifeq (${GOOS}, windows)
Expand Down Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.2.3
v3.2.4
9 changes: 0 additions & 9 deletions docs/Makefile

This file was deleted.

3 changes: 0 additions & 3 deletions docs/README.md

This file was deleted.

94 changes: 47 additions & 47 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const docTemplate = `{
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/trace.seismicEvent"
"$ref": "#/definitions/seisevent.Event"
}
}
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}
}
}`
Expand Down
94 changes: 47 additions & 47 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/trace.seismicEvent"
"$ref": "#/definitions/seisevent.Event"
}
}
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}
}
}
Loading

0 comments on commit 2569df3

Please sign in to comment.