diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be33202..252f15d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,21 +14,21 @@ on: default: false required: false type: boolean +env: + GO_VERSION: 1.21.0 jobs: build-go: name: Go - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [1.21.x] + runs-on: namespace-profile-linux-4vcpu-8gb-cached steps: - name: Checkout uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} - cache-dependency-path: "go.sum" + go-version: ${{ env.GO_VERSION }} + ## skip cache, use Namespace volume cache + cache: false - name: Build run: make build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce26211..b2c0ba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,10 @@ on: release: types: [created] +env: + GORELEASER_VERSION: v1.24.0 + GO_VERSION: 1.21.0 + permissions: contents: write @@ -13,21 +17,28 @@ jobs: uses: ./.github/workflows/test.yml goreleaser: - runs-on: ubuntu-latest + runs-on: namespace-profile-linux-4vcpu-8gb-cached + needs: go-test steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Go + - name: Setup Golang uses: actions/setup-go@v5 with: - go-version: stable - - name: Run GoReleaser + go-version: ${{ env.GO_VERSION }} + ## skip cache, use Namespace volume cache + cache: false + - name: Setup Namespace cache + uses: namespacelabs/nscloud-cache-action@v1 + with: + cache: go + - name: Run World CLI GoReleaser uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser - version: latest + version: ${{ env.GORELEASER_VERSION }} args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7ad74c..487c105 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - # Setup Docker build to use Namespace workspace builder - - name: Configure Namespace powered Buildx - uses: namespacelabs/nscloud-setup-buildx-action@v0 - name: Setup Golang uses: actions/setup-go@v5 with: @@ -39,6 +36,7 @@ jobs: shell: 'script -q -e -c "bash {0}"' run: make test-coverage - name: Upload coverage to Codecov + if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' uses: codecov/codecov-action@v4 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}