Browse Source

up test.yml

ljw 1 year ago
parent
commit
752d376dd7
1 changed files with 24 additions and 4 deletions
  1. 24 4
      .github/workflows/test.yml

+ 24 - 4
.github/workflows/test.yml

@@ -1,4 +1,4 @@
1
-name: Go Build and Release
1
+name: Build and Release
2
 
2
 
3
 on:
3
 on:
4
   push:
4
   push:
@@ -27,14 +27,34 @@ jobs:
27
         uses: actions/setup-go@v4
27
         uses: actions/setup-go@v4
28
         with:
28
         with:
29
           go-version: '1.22'  # 选择 Go 版本
29
           go-version: '1.22'  # 选择 Go 版本
30
-      - name: install gcc zip
30
+
31
+      - name: Set up npm
32
+        uses: actions/setup-node@v2
33
+        with:
34
+          node-version: '20'
35
+          cache: 'npm'
36
+
37
+      - name: install gcc zip musl
31
         run: |
38
         run: |
32
           if [ "${{ matrix.goos }}" = "windows" ]; then
39
           if [ "${{ matrix.goos }}" = "windows" ]; then
33
             sudo apt-get install gcc-mingw-w64-x86-64 zip -y
40
             sudo apt-get install gcc-mingw-w64-x86-64 zip -y
41
+          else
42
+            sudo apt-get install musl musl-dev musl-tools -y
34
           fi
43
           fi
35
 
44
 
45
+
46
+      - name: build rustdesk-api-web
47
+        run: |
48
+          git clone https://github.com/lejianwen/rustdesk-api-web
49
+          cd rustdesk-api-web
50
+          npm install
51
+          npm run build
52
+          cp -ar dist/* ../resources/admin/
53
+
36
       - name: tidy
54
       - name: tidy
37
         run: go mod tidy
55
         run: go mod tidy
56
+
57
+
38
       - name: swag
58
       - name: swag
39
         run: |
59
         run: |
40
           go install github.com/swaggo/swag/cmd/swag@latest
60
           go install github.com/swaggo/swag/cmd/swag@latest
@@ -50,10 +70,10 @@ jobs:
50
           mkdir -p release/data
70
           mkdir -p release/data
51
           mkdir -p release/runtime
71
           mkdir -p release/runtime
52
           if [ "${{ matrix.goos }}" = "windows" ]; then
72
           if [ "${{ matrix.goos }}" = "windows" ]; then
53
-            CC=x86_64-w64-mingw32-gcc GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -o ./release/apimain.exe ./cmd/apimain.go
73
+            GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go
54
             zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
74
             zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
55
           else
75
           else
56
-            GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
76
+            GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
57
             tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release 
77
             tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release 
58
           fi
78
           fi
59
 
79