From d88db3d9c196550bafd7b8389b07433089222287 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Tue, 21 Jan 2025 15:37:31 -0600 Subject: [PATCH] refactor: remove old CI workflows and consolidate into a new test workflow --- .gitea/workflows/pull-request-ci.yaml | 92 ------------------- .gitea/workflows/push-ci.yaml | 91 ------------------ .../{tag-release.yaml => release-tag.yaml} | 15 +-- .gitea/workflows/test-pr.yaml | 23 +++++ 4 files changed, 28 insertions(+), 193 deletions(-) delete mode 100644 .gitea/workflows/pull-request-ci.yaml delete mode 100644 .gitea/workflows/push-ci.yaml rename .gitea/workflows/{tag-release.yaml => release-tag.yaml} (58%) create mode 100644 .gitea/workflows/test-pr.yaml diff --git a/.gitea/workflows/pull-request-ci.yaml b/.gitea/workflows/pull-request-ci.yaml deleted file mode 100644 index 4793bda..0000000 --- a/.gitea/workflows/pull-request-ci.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: CI -on: - pull_request: - -jobs: - lint: - name: Lint - 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: - args: -D errcheck - version: latest - - test: - name: Test - 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: Get go dependencies - run: | - go mod tidy - - - name: Test - run: go test -race -v -shuffle=on ./... - - build: - name: Build - 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: Get go dependencies - run: | - go mod tidy - - - name: Build for linux - run: | - go build -o bin/SteamCache2-${VERSION}-${BUILD}-${GOOS}-${GOARCH}.exe main.go - env: - VERSION: ${{github.ref_name}} - BUILD: ${{github.run_number}} - GOOS: linux - GOARCH: amd64 - EXE: "" - - - name: Build for windows - run: | - go build -o bin/SteamCache2-${VERSION}-${BUILD}-${GOOS}-${GOARCH}.exe main.go - env: - VERSION: ${{github.ref_name}} - BUILD: ${{github.run_number}} - GOOS: windows - GOARCH: amd64 - EXE: ".exe" - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: SteamCache2-${{github.ref_name}}-${{github.run_number}} - path: bin/ \ No newline at end of file diff --git a/.gitea/workflows/push-ci.yaml b/.gitea/workflows/push-ci.yaml deleted file mode 100644 index f5191ea..0000000 --- a/.gitea/workflows/push-ci.yaml +++ /dev/null @@ -1,91 +0,0 @@ -name: CI -on: - push: - branches: [main, develop] - -jobs: - lint: - name: Lint - 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: - args: -D errcheck - version: latest - - test: - name: Test - 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: Get go dependencies - run: | - go mod tidy - - - name: Test - run: go test -race -v -shuffle=on ./... - - build: - name: Build - 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: Get go dependencies - run: | - go mod tidy - - - name: Build for linux - run: | - go build -o bin/SteamCache2-${VERSION}-${BUILD}-${GOOS}-${GOARCH}.exe main.go - env: - VERSION: ${{github.ref_name}} - BUILD: ${{github.run_number}} - GOOS: linux - GOARCH: amd64 - - - name: Build for windows - run: | - go build -o bin/SteamCache2-${VERSION}-${BUILD}-${GOOS}-${GOARCH}.exe main.go - env: - VERSION: ${{github.ref_name}} - BUILD: ${{github.run_number}} - GOOS: windows - GOARCH: amd64 - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: SteamCache2-${{github.ref_name}}-${{github.run_number}} - path: bin/ \ No newline at end of file diff --git a/.gitea/workflows/tag-release.yaml b/.gitea/workflows/release-tag.yaml similarity index 58% rename from .gitea/workflows/tag-release.yaml rename to .gitea/workflows/release-tag.yaml index 02143b3..e1cded0 100644 --- a/.gitea/workflows/tag-release.yaml +++ b/.gitea/workflows/release-tag.yaml @@ -2,30 +2,25 @@ name: Release on: push: tags: - - 'v*' + - '*' jobs: release: name: Build versioned release runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Setup go - uses: actions/setup-go@v5 + - run: git fetch --force --tags + - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - check-latest: true - cache: true - - name: Release binaries uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: 'latest' - args: release --clean + args: release env: GITEA_TOKEN: ${{secrets.RELEASE_TOKEN}} \ No newline at end of file diff --git a/.gitea/workflows/test-pr.yaml b/.gitea/workflows/test-pr.yaml new file mode 100644 index 0000000..96665bb --- /dev/null +++ b/.gitea/workflows/test-pr.yaml @@ -0,0 +1,23 @@ +name: CI +on: + - pull_request + +jobs: + check-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: tidy + run: go mod tidy + - name: lint + uses: golangci/golangci-lint-action@v3 + with: + args: -D errcheck + version: latest + - name: build + run: go build ./... + - name: test + run: go test -race -v -shuffle=on ./... \ No newline at end of file