From 709a06ffe66d8370a5efe2a22caaf98f859dd9e6 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Sun, 10 Mar 2024 17:01:08 -0500 Subject: [PATCH 1/3] more changes to ci --- .gitea/workflows/pull-request-ci.yaml | 117 ++++++++++++++++++ .gitea/workflows/{ci.yaml => push-ci.yaml} | 12 +- .../{release-tag.yaml => tag-release.yaml} | 56 +++++++++ 3 files changed, 176 insertions(+), 9 deletions(-) create mode 100644 .gitea/workflows/pull-request-ci.yaml rename .gitea/workflows/{ci.yaml => push-ci.yaml} (87%) rename .gitea/workflows/{release-tag.yaml => tag-release.yaml} (57%) diff --git a/.gitea/workflows/pull-request-ci.yaml b/.gitea/workflows/pull-request-ci.yaml new file mode 100644 index 0000000..08cacd7 --- /dev/null +++ b/.gitea/workflows/pull-request-ci.yaml @@ -0,0 +1,117 @@ +name: CI +on: + pull_request: + +jobs: + lint: + name: Lint + env: + RUNNER_TOOL_CACHE: /toolcache + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Install go dependencies + run: go mod tidy + + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + + test: + name: Test + env: + RUNNER_TOOL_CACHE: /toolcache + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Setup OS dependencies + run: | + apt-get update + apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev + + - name: Get fyne command + run: | + go install fyne.io/fyne/v2/cmd/fyne@latest + + - name: Get go dependencies + run: | + go mod tidy + + - name: Test + run: go test -race -v -shuffle=on ./... + + build: + name: Build + env: + RUNNER_TOOL_CACHE: /toolcache + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Setup OS dependencies + run: | + apt-get update + apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev + + - name: Get fyne command + run: | + go install fyne.io/fyne/v2/cmd/fyne@latest + + - name: Get go dependencies + run: | + go mod tidy + + - name: Build for linux + run: | + fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go + env: + BUILD: ${{github.run_number}} + GOOS: linux + GOARCH: amd64 + EXE: "" + CGO_ENABLED: 1 + CC: gcc + + - name: Build for windows + run: | + fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go + env: + BUILD: ${{github.run_number}} + GOOS: windows + GOARCH: amd64 + EXE: .exe + CGO_ENABLED: 1 + CC: x86_64-w64-mingw32-gcc + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: swiped-mod-switcher-${{github.ref_name}} + path: bin/ \ No newline at end of file diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/push-ci.yaml similarity index 87% rename from .gitea/workflows/ci.yaml rename to .gitea/workflows/push-ci.yaml index 4c54917..7b05566 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/push-ci.yaml @@ -2,18 +2,10 @@ name: CI on: push: branches: [master, develop] - pull_request: jobs: lint: name: Lint - permissions: - # Required: allow read access to the content for analysis. - contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - pull-requests: read - # Optional: Allow write access to checks to allow the action to annotate code in the PR. - checks: write env: RUNNER_TOOL_CACHE: /toolcache runs-on: ubuntu-latest @@ -28,11 +20,13 @@ jobs: check-latest: true cache: true + - name: Install go dependencies + run: go mod tidy + - name: Lint uses: golangci/golangci-lint-action@v3 with: version: latest - args: --verbose test: name: Test diff --git a/.gitea/workflows/release-tag.yaml b/.gitea/workflows/tag-release.yaml similarity index 57% rename from .gitea/workflows/release-tag.yaml rename to .gitea/workflows/tag-release.yaml index 9af8d8b..d189fb0 100644 --- a/.gitea/workflows/release-tag.yaml +++ b/.gitea/workflows/tag-release.yaml @@ -5,6 +5,62 @@ on: - 'v*' jobs: + lint: + name: Lint + env: + RUNNER_TOOL_CACHE: /toolcache + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Install go dependencies + run: go mod tidy + + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + + test: + name: Test + env: + RUNNER_TOOL_CACHE: /toolcache + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + cache: true + + - name: Setup OS dependencies + run: | + apt-get update + apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev + + - name: Get fyne command + run: | + go install fyne.io/fyne/v2/cmd/fyne@latest + + - name: Get go dependencies + run: | + go mod tidy + + - name: Test + run: go test -race -v -shuffle=on ./... + release: name: Build versioned release runs-on: ubuntu-latest From 31f3df710a3d89cb0832f497df6280ea28a5a5aa Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Sun, 10 Mar 2024 17:06:37 -0500 Subject: [PATCH 2/3] fixed artifact version issue --- .gitea/workflows/push-ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/push-ci.yaml b/.gitea/workflows/push-ci.yaml index 7b05566..f967709 100644 --- a/.gitea/workflows/push-ci.yaml +++ b/.gitea/workflows/push-ci.yaml @@ -93,6 +93,7 @@ jobs: run: | fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go env: + VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} GOOS: linux GOARCH: amd64 @@ -104,6 +105,7 @@ jobs: run: | fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go env: + VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} GOOS: windows GOARCH: amd64 From 7d37c75d64ba3b3612b70715bbd494f6e07d2dca Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Sun, 10 Mar 2024 17:08:56 -0500 Subject: [PATCH 3/3] switched tag-release to new style --- .gitea/workflows/tag-release.yaml | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/tag-release.yaml b/.gitea/workflows/tag-release.yaml index d189fb0..1f9ac88 100644 --- a/.gitea/workflows/tag-release.yaml +++ b/.gitea/workflows/tag-release.yaml @@ -87,21 +87,29 @@ jobs: - name: Build for linux run: | - VERSION=${{github.ref_name}} - BUILD=${{github.run_number}} - GOFLAGS="-ldflags=-s -ldflags=-w" - CGO_ENABLED=1 - CC=gcc - fyne package --os linux --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION}.${BUILD}-linux-amd64 main.go + fyne package --os linux --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-linux-amd64 main.go + env: + VERSION: ${{github.ref_name}} + BUILD: ${{github.run_number}} + GOOS: linux + GOARCH: amd64 + EXE: "" + CGO_ENABLED: 1 + CC: gcc + - name: Build for windows run: | - VERSION=${{github.ref_name}} - BUILD=${{github.run_number}} - GOFLAGS="-ldflags=-H=windowsgui -ldflags=-s -ldflags=-w" - CGO_ENABLED=1 - CC=x86_64-w64-mingw32-gcc - fyne package --os windows --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION}.${BUILD}-windows-amd64.exe main.go + fyne package --os windows --release --appVersion=${VERSION#v} --appBuild=${BUILD} --exe bin/sw1ped-mod-switcher-${VERSION#v}.${BUILD}-windows-amd64.exe main.go + env: + VERSION: ${{github.ref_name}} + BUILD: ${{github.run_number}} + GOOS: windows + GOARCH: amd64 + EXE: ".exe" + CGO_ENABLED: 1 + CC: x86_64-w64-mingw32-gcc + - name: Release binaries uses: https://gitea.com/actions/release-action@main