From 28486cc2267a49ba6770e9d9e8946ec08203e0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=ADtalo=20Silva?= Date: Thu, 4 Apr 2024 17:00:05 -0300 Subject: [PATCH 1/2] Create go.yml --- .github/workflows/go.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..7169e30 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,25 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Build + run: go build -v ./... From 86fc3e22293f18b1764f9411cac60a361f3f0a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=ADtalo=20Silva?= Date: Thu, 4 Apr 2024 18:34:03 -0300 Subject: [PATCH 2/2] Trying to fix build --- .github/workflows/go.yml | 48 +++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7169e30..291be62 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,16 +10,54 @@ on: branches: [ "master" ] jobs: + release: + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_name: ${{ github.event.repository.name }}-linux-amd64 + install_deps: sudo apt update && sudo apt install -y libc6-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config + env_vars: GOOS=linux GOARCH=amd64 + - os: ubuntu-latest + artifact_name: ${{ github.event.repository.name }}-windows-amd64.exe + install_deps: "" + env_vars: GOOS=windows GOARCH=amd64 CGO_ENABLED=0 + build_args: -a -ldflags '-extldflags "-static" -s -w' + - os: macos-latest + artifact_name: ${{ github.event.repository.name }}-darwin-arm64 + install_deps: "" + env_vars: GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 + build_args: -a -ldflags '-s -w' + - os: macos-latest + artifact_name: ${{ github.event.repository.name }}-darwin-amd64 + install_deps: "" + env_vars: GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 + build_args: -a -ldflags '-s -w' + + runs-on: ${{ matrix.os }} - build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.22' + + - name: Install dependencies + run: ${{ matrix.install_deps }} - name: Build - run: go build -v ./... + run: ${{ matrix.env_vars }} go build ${{ matrix.build_args }} -o dist/${{ matrix.artifact_name }} + + - name: Compress binaries + run: gzip dist/${{ matrix.artifact_name }} + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/${{ matrix.artifact_name }}.gz + asset_name: ${{ matrix.artifact_name }}.gz + tag: ${{ github.ref }}