diff --git a/.github/workflows/beekeeper.yml b/.github/workflows/beekeeper.yml index 0cb7c41fe2f..8dae2ec650e 100644 --- a/.github/workflows/beekeeper.yml +++ b/.github/workflows/beekeeper.yml @@ -48,35 +48,71 @@ jobs: with: fetch-depth: 0 ref: ${{ github.event.client_payload.ref }} - - name: Setup Go - uses: actions/setup-go@v6 - with: - cache: false - go-version-file: go.mod - - name: Cache Go Modules - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Get Commit Message id: commit run: | MSG=$(git log --format=%s -n 1 ${{github.event.after}}) echo "msg=${MSG}" >> $GITHUB_OUTPUT - - name: Build - 0 - run: | - make binary - mv dist/bee bee-0 - - name: Apply patches and build - 1 + + build-bee: + name: Build bee binaries + runs-on: ubuntu-latest + needs: [init] + strategy: + matrix: + include: + - variant: "0" + patched: false + - variant: "1" + patched: true + steps: + - name: Checkout + uses: actions/checkout@v5 + if: github.event.action != 'beekeeper' + with: + fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v5 + if: github.event.action == 'beekeeper' + with: + fetch-depth: 0 + ref: ${{ github.event.client_payload.ref }} + - name: Setup Go + uses: actions/setup-go@v6 + with: + cache: true + go-version-file: go.mod + - name: Apply patches + if: matrix.patched run: | patch pkg/api/postage.go .github/patches/postage_api.patch patch pkg/retrieval/retrieval.go .github/patches/retrieval.patch + - name: Build + run: | make binary - mv dist/bee bee-1 + mv dist/bee bee-${{ matrix.variant }} + - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: bee-${{ matrix.variant }} + path: bee-${{ matrix.variant }} + retention-days: 5 + + install-beekeeper: + name: Install beekeeper + runs-on: ubuntu-latest + needs: [init] + steps: + - name: Checkout + uses: actions/checkout@v5 + if: github.event.action != 'beekeeper' + with: + fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v5 + if: github.event.action == 'beekeeper' + with: + fetch-depth: 0 + ref: ${{ github.event.client_payload.ref }} - name: Install beekeeper run: | export PATH=$(pwd):$PATH @@ -86,14 +122,11 @@ jobs: mv ~/.beekeeper/local.yaml local.yaml - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: - name: temp-artifacts + name: beekeeper-artifacts include-hidden-files: true path: | Dockerfile.goreleaser Makefile - bee-0 - bee-1 - bee-2 beekeeper local.yaml .beekeeper.yaml @@ -102,18 +135,22 @@ jobs: beekeeper: name: Integration tests runs-on: ubuntu-latest - needs: [init] + needs: [build-bee, install-beekeeper] steps: - - name: Cache + - name: Cache k3s uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: path: | /tmp/k3s-${{ env.K3S_VERSION }} key: k3s-${{ env.K3S_VERSION }} - - name: "Download Artifact" + - name: Download beekeeper artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: beekeeper-artifacts + - name: Download bee-1 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: temp-artifacts + name: bee-1 - name: Unpack artifacts run: | chmod +x bee-1 beekeeper .github/bin/beekeeper_artifacts.sh @@ -232,10 +269,14 @@ jobs: needs: [beekeeper] runs-on: ubuntu-latest steps: - - name: "Download Artifact" + - name: Download bee-0 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: bee-0 + - name: Download beekeeper artifacts uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: temp-artifacts + name: beekeeper-artifacts - name: Unpack artifacts run: | chmod +x bee-0 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 51afeff511a..a3acbe38bab 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,11 +20,12 @@ on: jobs: test: - name: Test - runs-on: ${{ matrix.os }} + name: Test (Linux, shard ${{ matrix.shard }}) + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + shard: [0, 1, 2, 3] steps: - name: Checkout uses: actions/checkout@v5 @@ -33,23 +34,36 @@ jobs: with: cache: true go-version-file: go.mod - - name: Increase UDP buffer sizes (Ubuntu) - if: matrix.os == 'ubuntu-latest' + - name: Increase UDP buffer sizes run: | sudo sysctl -w net.core.rmem_max=7500000 sudo sysctl -w net.core.wmem_max=7500000 + - name: Test shard with race detector + run: | + PKGS=$(go list ./... | awk 'NR % 4 == ${{ matrix.shard }}' | tr '\n' ' ') + go test -race -failfast $PKGS + + test-compat: + name: Build check (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Setup Go + uses: actions/setup-go@v6 + with: + cache: true + go-version-file: go.mod - name: Increase UDP buffer sizes (macOS) if: matrix.os == 'macos-latest' - run: | - sudo sysctl -w kern.ipc.maxsockbuf=6291456 + run: sudo sysctl -w kern.ipc.maxsockbuf=6291456 - name: Build run: make build - - name: Test with race detector (Ubuntu and MacOS) - if: matrix.os != 'windows-latest' - run: make test-ci-race - - name: Test without race detector (Windows) - if: matrix.os == 'windows-latest' - run: make test-ci + lint: name: Lint runs-on: ubuntu-latest @@ -77,6 +91,7 @@ jobs: run: make check-whitespace - name: go mod tidy check uses: katexochen/go-tidy-check@v2 + coverage: name: Coverage Report if: github.ref == 'refs/heads/master' @@ -87,15 +102,8 @@ jobs: - name: Setup Go uses: actions/setup-go@v6 with: - cache: false + cache: true go-version-file: go.mod - - name: Cache Go Modules - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-coverage-${{ hashFiles('**/go.sum') }} - name: Test with code coverage run: make cover=1 test-ci - name: Upload coverage to Codecov @@ -104,21 +112,17 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true files: ./cover.out + trigger-beekeeper: name: Trigger Beekeeper runs-on: ubuntu-latest - needs: [test, lint, coverage] + needs: [test, lint] if: github.ref == 'refs/heads/master' steps: - name: Checkout uses: actions/checkout@v5 with: fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@v6 - with: - cache: false - go-version-file: go.mod - name: Trigger Beekeeper uses: peter-evans/repository-dispatch@v2 with: