Skip to content

Commit 6c1a1df

Browse files
authored
Merge pull request #820 from marle3003/develop
Develop
2 parents 50e30ed + 0f33424 commit 6c1a1df

205 files changed

Lines changed: 7020 additions & 3576 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: build-alpha-release-notes
2+
description: build-alpha-release-notes
3+
inputs:
4+
version:
5+
required: true
6+
description: The alpha version
7+
latest-tag:
8+
description: The latest tag or empty
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Generate alpha release notes
13+
if: inputs.latest-tag != ''
14+
shell: bash
15+
run: |
16+
{
17+
echo "# Mokapi Release ${{ inputs.version }}"
18+
echo
19+
echo "⚠️ Automatically generated alpha build."
20+
echo
21+
echo "- Alpha version: ${{ inputs.version }}"
22+
echo "- Commit: $(git rev-parse --short HEAD)"
23+
echo "- Built at: $(date -u +"%Y-%m-%d %H:%M:%S UTC")"
24+
echo
25+
echo "## Changes since ${{ inputs.latest-tag }}"
26+
echo
27+
git log "${{ inputs.latest-tag }}..HEAD" \
28+
--oneline \
29+
--no-merges |
30+
grep -v -E 'github-actions\[bot\]|dependabot\[bot\]|test|Bump' |
31+
sed 's/^[a-f0-9]\{7,40\} //' | # remove SHA prefix
32+
awk '!seen[$0]++' |
33+
sed 's/^/- /'
34+
} > docs/release.md
35+
- name: Upload UI artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: release-notes
39+
path: docs/release.md
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Build Mokapi CLI Flags doc"
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Create directory and file
6+
shell: bash
7+
run: |
8+
mkdir -p webui/dist
9+
touch webui/dist/.tmp
10+
- name: Build CLI doc
11+
shell: bash
12+
run: go run ./cmd/internal/gen-cli-docs/main.go
13+
- name: Add CLI Flags nav entry
14+
working-directory: ./docs
15+
shell: bash
16+
run: |
17+
jq '.Configuration.items.Static.items["CLI Flags"] = "configuration/static/mokapi.md"' ./config.json > ./tmp.json
18+
mv ./tmp.json ./config.json

.github/actions/build-mokapi-image/action.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: "Build Mokapi image"
2-
description: "Builds and deploys the React frontend to AWS S3"
32
inputs:
43
image-name:
54
required: true
@@ -10,27 +9,20 @@ inputs:
109
version:
1110
required: true
1211
description: "The version of mokapi to build"
13-
type: string
12+
latest-tag:
13+
required: true
14+
description: "The latest tag"
1415
runs:
1516
using: "composite"
1617
steps:
1718
- uses: actions/setup-go@v5
1819
with:
1920
go-version: 1.25.5
20-
- name: Create directory and file
21-
run: |
22-
mkdir -p webui/dist
23-
touch webui/dist/.tmp
24-
shell: bash
25-
- name: Build CLI doc
26-
run: go run ./cmd/internal/gen-cli-docs/main.go
27-
shell: bash
28-
- name: Add CLI Flags nav entry
29-
run: |
30-
jq '.Configuration.items.Static.items["CLI Flags"] = "configuration/static/mokapi.md"' ./config.json > ./tmp.json
31-
mv ./tmp.json ./config.json
32-
working-directory: ./docs
33-
shell: bash
21+
- uses: ./.github/actions/build-cli-flags-doc
22+
- uses: ./.github/actions/build-alpha-release-notes
23+
with:
24+
version: ${{ inputs.version }}
25+
latest-tag: ${{ inputs.latest-tag }}
3426
- name: Build docker alpha image
3527
run: docker build --build-arg VERSION=${{ inputs.version }} -t ${{ inputs.image-name }} -t mokapi/mokapi:alpha -f ./images/alpha.Dockerfile .
3628
shell: bash
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: build-release-notes
2+
description: build-release-notes
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Write release notes
7+
shell: bash
8+
run: |
9+
VERSION="${{ github.event.release.tag_name }}"
10+
BODY="${{ github.event.release.body }}"
11+
echo "# Mokapi ${VERSION}\n\n${BODY}" > docs/release.md
12+
- name: Upload UI artifact
13+
uses: actions/upload-artifact@v4
14+
with:
15+
name: release-notes
16+
path: docs/release.md

.github/workflows/alpha.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ jobs:
1616
outputs:
1717
version: ${{ steps.get_version.outputs.version }}
1818
image-name: ${{ steps.get_version.outputs.image-name }}
19+
latest-tag: ${{ steps.get_version.outputs.latest_tag }}
1920
steps:
2021
- name: Check out code
2122
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 0 # Ensure all tags are fetched
25+
- name: Fetch main
26+
shell: bash
27+
run: git fetch origin main --tags --force
2428
- name: get version
2529
id: get_version
2630
shell: bash
@@ -40,8 +44,9 @@ jobs:
4044
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
4145
4246
echo "New version: $NEW_VERSION"
43-
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
47+
echo "version=$NEW_VERSION-alpha" >> $GITHUB_OUTPUT
4448
echo "image-name=mokapi/mokapi:$NEW_VERSION-alpha" >> $GITHUB_OUTPUT
49+
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
4550
4651
build-alpha:
4752
needs: setup
@@ -52,6 +57,7 @@ jobs:
5257
artifact-test-report: playwright-report
5358
report-publish-path: reports/${{ github.ref_name }}
5459
version: ${{ needs.setup.outputs.version }}
60+
latest-tag: ${{ needs.setup.outputs.latest-tag }}
5561

5662
publish-image:
5763
name: Publish docker image

.github/workflows/release.yml

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,49 @@ permissions:
1010
contents: write
1111

1212
jobs:
13-
release-linux:
14-
name: Release
13+
build-dashboard:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: 1.25.5
22+
- uses: ./.github/actions/build-cli-flags-doc
23+
- uses: ./.github/actions/build-release-notes
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 23
27+
registry-url: 'https://registry.npmjs.org'
28+
- run: npm install
29+
working-directory: ./webui
30+
- name: Install taskfile
31+
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
32+
- name: Build
33+
run: task build-vue-app
34+
env:
35+
CGO_ENABLED: 0
36+
- name: Upload UI artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: dashboard
40+
path: webui/dist
41+
42+
release-unix:
43+
needs: build-dashboard
1544
runs-on: ubuntu-latest
1645
env:
1746
DOCKER_CLI_EXPERIMENTAL: "enabled"
1847
steps:
1948
- uses: actions/checkout@v4
2049
with:
2150
fetch-depth: 0
51+
- name: Download dashboard
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: dashboard
55+
path: webui/dist
2256
- name: Set up QEMU
2357
uses: docker/setup-qemu-action@v3
2458
- name: Set up Docker Buildx
@@ -31,17 +65,6 @@ jobs:
3165
- uses: actions/setup-go@v5
3266
with:
3367
go-version: 1.25.5
34-
- uses: actions/setup-node@v4
35-
with:
36-
node-version: 23
37-
registry-url: 'https://registry.npmjs.org'
38-
- run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
39-
- run: npm install
40-
working-directory: ./webui
41-
- name: Build
42-
run: task build-vue-app
43-
env:
44-
CGO_ENABLED: 0
4568
- name: Run GoReleaser
4669
uses: goreleaser/goreleaser-action@v6
4770
with:
@@ -50,17 +73,19 @@ jobs:
5073
env:
5174
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5275
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
53-
- name: Publish npm
54-
run: task publish-npm-package VERSION=${GITHUB_REF##*/v}
55-
env:
56-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5776

5877
release-windows:
78+
needs: build-dashboard
5979
runs-on: windows-latest
6080
steps:
6181
- uses: actions/checkout@v4
6282
with:
6383
fetch-depth: 0
84+
- name: Download dashboard
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: dashboard
88+
path: webui/dist
6489
- uses: actions/setup-go@v5
6590
with:
6691
go-version: 1.25.5
@@ -69,12 +94,6 @@ jobs:
6994
node-version: 23
7095
registry-url: 'https://registry.npmjs.org'
7196
- run: choco install go-task
72-
- run: npm install
73-
working-directory: ./webui
74-
- name: Build
75-
run: task build-vue-app
76-
env:
77-
CGO_ENABLED: 0
7897
- name: Install goversioninfo
7998
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0
8099
- name: Generate Windows metadata (.syso)
@@ -107,3 +126,21 @@ jobs:
107126
env:
108127
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109128
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
129+
130+
release-npm:
131+
needs: build-dashboard
132+
runs-on: ubuntu-latest
133+
steps:
134+
- name: Download dashboard
135+
uses: actions/download-artifact@v4
136+
with:
137+
name: dashboard
138+
path: webui/dist
139+
- name: Install taskfile
140+
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
141+
- name: Build
142+
run: task build-vue-app
143+
env:
144+
CGO_ENABLED: 0
145+
- name: Publish
146+
run: task publish-npm-package VERSION=${GITHUB_REF##*/v}

.github/workflows/test.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
required: true
1919
description: "The version of mokapi to build"
2020
type: string
21+
latest-tag:
22+
description: "The latest tag"
23+
type: string
2124

2225
jobs:
2326
build:
@@ -26,11 +29,17 @@ jobs:
2629
steps:
2730
- name: Check out code
2831
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
fetch-tags: true
35+
- name: Fetch main
36+
run: git fetch origin main --tags --force
2937
- uses: ./.github/actions/build-mokapi-image
3038
with:
3139
image-name: ${{ inputs.image-name }}
3240
artifact-name: ${{ inputs.image-artifact-name }}
3341
version: ${{ inputs.version }}
42+
latest-tag: ${{ inputs.latest-tag }}
3443

3544
test:
3645
name: Run UI tests
@@ -55,9 +64,7 @@ jobs:
5564
steps:
5665
- name: Check out code
5766
uses: actions/checkout@v4
58-
with:
59-
path: src
60-
- uses: ./src/.github/actions/publish-test-report
67+
- uses: ./.github/actions/publish-test-report
6168
with:
6269
artifact-test-report: ${{ inputs.artifact-test-report }}
6370
test-report-path: ${{ inputs.report-publish-path }}

acceptance/mail_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func (suite *MailSuite) SetupSuite() {
3636
}
3737

3838
func (suite *MailSuite) TestSendMail() {
39+
time.Sleep(2 * time.Second)
40+
3941
ca := cert.DefaultRootCert()
4042

4143
err := smtptest.SendMail("from@foo.bar",

acceptance/petstore_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ func (suite *PetStoreSuite) TestApi() {
5757
"description": "",
5858
"servers": []interface{}{
5959
map[string]interface{}{
60-
"description": "",
6160
"host": "127.0.0.1:19092",
6261
"name": "broker",
6362
"protocol": "kafka",
63+
"title": "",
64+
"summary": "",
65+
"description": "",
6466
},
6567
},
6668

@@ -120,8 +122,8 @@ func (suite *PetStoreSuite) TestApi() {
120122
},
121123
"name": "petstore.order-event",
122124
"partitions": []interface{}{
123-
map[string]interface{}{"id": float64(0), "leader": map[string]interface{}{"addr": "127.0.0.1:19092", "name": "broker"}, "offset": float64(1), "segments": float64(1), "startOffset": float64(0)},
124-
map[string]interface{}{"id": float64(1), "leader": map[string]interface{}{"addr": "127.0.0.1:19092", "name": "broker"}, "offset": float64(0), "segments": float64(0), "startOffset": float64(0)},
125+
map[string]interface{}{"id": float64(0), "offset": float64(1), "segments": float64(1), "startOffset": float64(0)},
126+
map[string]interface{}{"id": float64(1), "offset": float64(0), "segments": float64(0), "startOffset": float64(0)},
125127
},
126128
}},
127129
}
@@ -172,7 +174,7 @@ func (suite *PetStoreSuite) TestJsHttpHandler() {
172174

173175
// test http metrics
174176
try.GetRequest(suite.T(), fmt.Sprintf("http://127.0.0.1:%d/api/metrics/http?path=/pet/{petId}", suite.cfg.Api.Port), nil,
175-
try.BodyContains(`http_requests_total{service=\"Swagger Petstore\",endpoint=\"/pet/{petId}\"}","value":4}`),
177+
try.BodyContains(`http_requests_total{service=\"Swagger Petstore\",endpoint=\"/pet/{petId}\",method=\"GET\"}","value":4}`),
176178
)
177179
}
178180

api/handler_events_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func TestHandler_KafkaEvents(t *testing.T) {
274274
fn: func(t *testing.T, h http.Handler, sm *events.StoreManager) {
275275
sm.SetStore(1, events.NewTraits().WithNamespace("kafka"))
276276

277-
err := sm.Push(&store.KafkaLog{
277+
err := sm.Push(&store.KafkaMessageLog{
278278
Offset: 123,
279279
Key: store.LogValue{},
280280
Message: store.LogValue{},
@@ -283,6 +283,8 @@ func TestHandler_KafkaEvents(t *testing.T) {
283283
ProducerId: 3,
284284
ProducerEpoch: 1,
285285
SequenceNumber: 2,
286+
ClientId: "foo",
287+
ScriptFile: "123-123",
286288
}, events.NewTraits().WithNamespace("kafka"))
287289
require.NoError(t, err)
288290

@@ -315,6 +317,8 @@ func TestHandler_KafkaEvents(t *testing.T) {
315317
"producerId": float64(3),
316318
"schemaId": float64(0),
317319
"sequenceNumber": float64(2),
320+
"clientId": "foo",
321+
"script": "123-123",
318322
},
319323
m[0]["data"])
320324
}))

0 commit comments

Comments
 (0)