]> 127.0.0.1 Git - forward/.git/commitdiff
Create go.yml
authorqydysky <qydysky@foxmail.com>
Sun, 14 Apr 2024 03:42:59 +0000 (11:42 +0800)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2024 03:42:59 +0000 (11:42 +0800)
.github/workflows/go.yml [new file with mode: 0644]

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
new file mode 100644 (file)
index 0000000..b1952a3
--- /dev/null
@@ -0,0 +1,154 @@
+name: Release
+
+on:
+  push:
+    branches:
+    - 'main'
+
+jobs:
+  buildtest:
+    name: test_ubuntu_go${{ matrix.go }}
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
+
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+
+    - name: golangci-lint
+      uses: golangci/golangci-lint-action@v4
+      with:
+        args: --timeout 5m --verbose
+
+    - name: Test
+      run: |
+        go get .
+        CGO_ENABLED=0 go test -v --cover -coverprofile=coverage ./...
+
+    - name: Codecov
+      uses: codecov/codecov-action@v4
+      with:
+        token: ${{secrets.CODECOV_TOKEN}}
+        file: coverage
+
+  u-build:
+    name: build_ubuntu_go${{ matrix.go }}
+    needs: [buildtest]
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
+
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+    - name: Build
+      run: |
+        go get .
+        CGO_ENABLED=0 go build -pgo=auto -v -buildmode=exe main.go
+      
+    - name: zip
+      run: zip -q -r ubuntu_go${{ matrix.go }}.zip demo
+
+    - name: Upload a Release Asset
+      uses: softprops/action-gh-release@v2
+      with:
+        draft: true
+        files: |
+          ./ubuntu_go${{ matrix.go }}.zip
+
+  w-build:
+    name: build_windows_go${{ matrix.go }}
+    needs: [buildtest]
+    runs-on: windows-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
+
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+
+    - name: Build
+      run: |
+        go get .
+        go build -pgo=auto -v -buildmode=exe main.go
+        
+    - name: zip
+      run: .\7za.exe a -r .\windows_go${{ matrix.go }}.zip ./demo
+
+    - name: Upload a Release Asset
+      uses: softprops/action-gh-release@v2
+      with:
+        draft: true
+        files: |
+          ./windows_go${{ matrix.go }}.zip
+
+  m-build:
+    name: build_macos_go${{ matrix.go }}
+    needs: [buildtest]
+    runs-on: macos-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
+
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+
+    - name: Build
+      run: |
+        go get .
+        go build -pgo=auto -v -buildmode=exe main.go
+        
+    - name: zip
+      run: zip -q -r macos_go${{ matrix.go }}.zip demo
+
+    - name: Upload a Release Asset
+      uses: softprops/action-gh-release@v2
+      with:
+        draft: true
+        files: |
+          ./macos_go${{ matrix.go }}.zip