| 1 | name: Go Build |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | pull_request: |
| 6 | paths-ignore: |
| 7 | - '**/*.md' |
| 8 | push: |
| 9 | branches: |
| 10 | - 'master' |
| 11 | |
| 12 | concurrency: |
| 13 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} |
| 14 | cancel-in-progress: true |
| 15 | |
| 16 | jobs: |
| 17 | go-build: |
| 18 | if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' |
| 19 | runs-on: ${{ fromJSON(github.repository == 'ipfs/kubo' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }} |
| 20 | timeout-minutes: 20 |
| 21 | env: |
| 22 | TEST_DOCKER: 0 |
| 23 | TEST_VERBOSE: 1 |
| 24 | GIT_PAGER: cat |
| 25 | IPFS_CHECK_RCMGR_DEFAULTS: 1 |
| 26 | defaults: |
| 27 | run: |
| 28 | shell: bash |
| 29 | steps: |
| 30 | - uses: actions/checkout@v6 |
| 31 | - uses: actions/setup-go@v6 |
| 32 | with: |
| 33 | go-version-file: 'go.mod' |
| 34 | cache: true |
| 35 | cache-dependency-path: go.sum |
| 36 | |
| 37 | - name: Build all platforms |
| 38 | run: | |
| 39 | # Read platforms from build-platforms.yml and build each one |
| 40 | echo "Building kubo for all platforms..." |
| 41 | |
| 42 | # Read and build each platform |
| 43 | grep '^ - ' .github/build-platforms.yml | sed 's/^ - //' | while read -r platform; do |
| 44 | if [ -z "$platform" ]; then |
| 45 | continue |
| 46 | fi |
| 47 | |
| 48 | echo "::group::Building $platform" |
| 49 | GOOS=$(echo "$platform" | cut -d- -f1) |
| 50 | GOARCH=$(echo "$platform" | cut -d- -f2) |
| 51 | |
| 52 | echo "Building $platform" |
| 53 | echo " GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs" |
| 54 | GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs |
| 55 | echo "::endgroup::" |
| 56 | done |
| 57 | |
| 58 | echo "All platforms built successfully" |