From: qydysky Date: Sun, 14 Apr 2024 03:42:59 +0000 (+0800) Subject: Create go.yml X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=4db3b23c6eede38d733eafeae4b8b9784db44321;p=forward%2F.git Create go.yml --- diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..b1952a3 --- /dev/null +++ b/.github/workflows/go.yml @@ -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