Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
DVKunion committed Apr 2, 2024
1 parent ddec7d8 commit f7cff26
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 115 deletions.
15 changes: 8 additions & 7 deletions .github/conf/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
before:
hooks:
- go mod tidy
-
builds:
- binary: seamoon
env:
- CGO_ENABLED=0
main: ./cmd/main.go
goos:
- linux
- windows
- darwin
ignore:
# modernc.org/[email protected] not implement if these platform
- goos: darwin
goarch: 386
- goos: windows
goarch: 386
goarm:
- 6
- 7
ldflags:
- -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.Sha}}
- -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.ShortCommit}}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
upx:
- enabled: true
goos: [linux, darwin]
goos: [ linux, darwin ]
compress: best
changelog:
sort: asc
Expand Down
43 changes: 35 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: SeaMoon

name: seamoon-build
on:
push:
tags:
- "*"
pull_request:
branches: [ "main" ]
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
build:
Expand All @@ -29,4 +29,31 @@ jobs:
go build -o seamoon -v --ldflags "-s -w -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Version=${{github.ref_name}} -X github.com/DVKunion/SeaMoon/pkg/system/xlog.Commit=${{github.sha}}" cmd/main.go
- uses: actions/upload-artifact@v4
with:
path: seamoon
path: seamoon
build-docker:
name: build-docker
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
name: login docker.io
with:
registry: "docker.io"
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
linux/arm64
linux/386
tags: |
docker.io/dvkunion/seamoon:latest
docker.io/dvkunion/seamoon:${{github.ref_name}}
build-args: |
VERSION=${{github.ref_name}}
context: ./
85 changes: 0 additions & 85 deletions .github/workflows/package.yaml

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy

name: seamoon-package
on:
push:
branches: [ "main", "feat/docs" ]
workflow_call:

jobs:
# Single deploy job since we're just deploying
deploy:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: goreleaser

name: seamoon-goreleaser
on:
push:
tags:
- "*"

workflow_call:
secrets:
GO_RELEASER_GITHUB_TOKEN:
required: true
jobs:
build:
name: GoReleaser build
Expand All @@ -14,6 +13,13 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Front
run: |
cd web && npm install | true && npm run build && cp -r dist ../cmd/client/static
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/seamoon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: seamoon
on: [ push, pull_request ]
jobs:
build:
uses: ./.github/workflows/build.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
docs:
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feat/docs' }}
uses: ./.github/workflows/pages.yml
release:
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/release.yml
secrets:
GO_RELEASER_GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
sync:
needs: [ build ]
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/sync.yml
secrets:
ALIYUN_USERNAME: ${{ secrets.ALIYUN_USERNAME }}
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_PASSWORD }}
TENCENT_USERNAME: ${{ secrets.TENCENT_USERNAME }}
TENCENT_PASSWORD: ${{ secrets.TENCENT_PASSWORD }}

77 changes: 77 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: seamoon-package
on:
workflow_call:
secrets:
ALIYUN_USERNAME:
required: true
ALIYUN_PASSWORD:
required: true
TENCENT_USERNAME:
required: true
TENCENT_PASSWORD:
required: true

jobs:
sync-aliyun:
name: sync-aliyun
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
registry: [ registry.cn-hangzhou.aliyuncs.com,
registry.cn-shanghai.aliyuncs.com,
registry.cn-qingdao.aliyuncs.com,
registry.cn-beijing.aliyuncs.com,
registry.cn-zhangjiakou.aliyuncs.com,
registry.cn-huhehaote.aliyuncs.com,
registry.cn-shenzhen.aliyuncs.com,
registry.cn-chengdu.aliyuncs.com,
registry.cn-hongkong.aliyuncs.com,
registry.ap-northeast-1.aliyuncs.com,
registry.ap-southeast-1.aliyuncs.com,
registry.ap-southeast-2.aliyuncs.com,
registry.ap-southeast-3.aliyuncs.com,
registry.ap-southeast-5.aliyuncs.com,
registry.ap-south-1.aliyuncs.com,
registry.eu-central-1.aliyuncs.com,
registry.eu-west-1.aliyuncs.com,
registry.us-west-1.aliyuncs.com,
registry.us-east-1.aliyuncs.com
]
repo: seamoon/seamoon
steps:
- uses: actions/checkout@v4
- name: skopeo-copy
run: |
skopeo sync --src docker --dest docker --dest-creds ${{ secrets.ALIYUN_USERNAME }}:${{ secrets.ALIYUN_PASSWORD }} docker.io/dvkunion/seamoon:${{github.ref_name}} ${{ matrix.registry }}/${{ matrix.repo }}
skopeo sync --src docker --dest docker --dest-creds ${{ secrets.ALIYUN_USERNAME }}:${{ secrets.ALIYUN_PASSWORD }} docker.io/dvkunion/seamoon:latest ${{ matrix.registry }}/${{ matrix.repo }}
package-tencent:
name: package-tecent
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
registry: [ hkccr.ccs.tencentyun.com,
inccr.ccs.tencentyun.com,
sgccr.ccs.tencentyun.com,
thccr.ccs.tencentyun.com,
krccr.ccs.tencentyun.com,
jpccr.ccs.tencentyun.com,
deccr.ccs.tencentyun.com,
useccr.ccs.tencentyun.com,
uswccr.ccs.tencentyun.com,
ccr.ccs.tencentyun.com
]
repo: seamoon/seamoon
include:
- registry: ccr.ccs.tencentyun.com
repo: dvkunion/seamoon
steps:
- uses: actions/checkout@v4
- name: skopeo-copy
run: |
skopeo sync --src docker --dest docker --dest-creds ${{ secrets.TENCENT_USERNAME }}:${{ secrets.TENCENT_PASSWORD }} docker.io/dvkunion/seamoon:${{github.ref_name}} ${{ matrix.registry }}/${{ matrix.repo }}
skopeo sync --src docker --dest docker --dest-creds ${{ secrets.TENCENT_USERNAME }}:${{ secrets.TENCENT_PASSWORD }} docker.io/dvkunion/seamoon:latest ${{ matrix.registry }}/${{ matrix.repo }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build stage
FROM node:20 as front
FROM node:20.12-alpine3.19 as front
COPY .. /src
WORKDIR /src/web
RUN npm run build
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/function/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Tunnel: React.FC = () => {
rowKey={"ID"}
showActions="hover"
rowSelection={{}}
grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3}}
grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3, xxl: 3}}
onItem={(record: Serverless.Tunnel) => {
return {
onClick: () => {
Expand Down
7 changes: 4 additions & 3 deletions web/src/pages/service/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Proxy: React.FC = () => {
rowKey={"ID"}
showActions="hover"
rowSelection={{}}
grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3}}
grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3, xxl: 3}}
onItem={(record: any) => {
return {
onClick: () => {
Expand Down Expand Up @@ -134,7 +134,7 @@ const Proxy: React.FC = () => {
content: {
render: (_, record) => {
const oRecord = oData.get(record.id);
return <ProCard gutter={8} style={{margin: "-6% 0 -4% -3%"}} >
return <ProCard gutter={8} style={{margin: "-6% 0 -4% -3%"}}>
<ProCard colSpan={12} split={"horizontal"} style={{marginLeft: "-3%"}}>
<Statistic title="当前连接:" value={record.conn}
trend={calcThread(record.conn, oRecord === undefined ? 0 : oRecord.conn)}/>
Expand All @@ -150,7 +150,8 @@ const Proxy: React.FC = () => {
<ProCard colSpan={12} split={"horizontal"}>
<Statistic title="当前延迟:" value={record.lag + " ms"}
trend={calcThread(record.lag, oRecord === undefined ? 0 : oRecord.lag)}/>
<Statistic title="下行速率:" value={record.speed_down === 0 ? "未测速" : record.speed_down.toFixed(2) + " Mbps"}
<Statistic title="下行速率:"
value={record.speed_down === 0 ? "未测速" : record.speed_down.toFixed(2) + " Mbps"}
trend={record.speed_down === 0 ? undefined : calcThread(record.speed_down, oRecord === undefined ? 0 : oRecord.speed_down)}/>
<Statistic title="总计流出:" valueRender={() => {
return SpeedTransfer({
Expand Down

0 comments on commit f7cff26

Please sign in to comment.