refactor(ci): optimize build workflows (#10973)
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Check / lint (push) Waiting to run
Docker Check / build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run

* ci: optimize build workflows

- use go version from go.mod instead of hardcoding
- group platforms by OS for parallel builds
- remove legacy try-build targets

* fix: checkout before setup-go in all workflows

setup-go needs go.mod to be present, so checkout must happen first

* chore: remove deprecated // +build syntax

go 1.17+ uses //go:build, the old syntax is no longer needed

* simplify: remove nofuse tag from CI workflows

- workflows now rely on platform build constraints
- keep make nofuse target for manual builds
- remove unused appveyor.yml

* ci: remove legacy travis variable and fix gateway-conformance

- remove TRAVIS env variable from 4 workflows
- fix gateway-conformance checkout path to match working-directory
- replace deprecated cache-go-action with built-in setup-go caching
This commit is contained in:
Marcin Rataj 2025-09-19 14:44:38 +02:00 committed by GitHub
parent 6e38f6ffd5
commit 9faefe316f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 106 additions and 178 deletions

17
.github/build-platforms.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Build platforms configuration for Kubo
# Matches https://github.com/ipfs/distributions/blob/master/dists/kubo/build_matrix
# plus linux-riscv64 for emerging architecture support
#
# The Go compiler handles FUSE support automatically via build tags.
# Platforms are simply listed - no need to specify FUSE capability.
platforms:
- darwin-amd64
- darwin-arm64
- freebsd-amd64
- linux-amd64
- linux-arm64
- linux-riscv64
- openbsd-amd64
- windows-amd64
- windows-arm64

View File

@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 1.25.x
go-version-file: 'go.mod'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@ -46,17 +46,16 @@ jobs:
output: fixtures
# 2. Build the kubo-gateway
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 1.25.x
- uses: protocol/cache-go-action@v1
with:
name: ${{ github.job }}
- name: Checkout kubo-gateway
uses: actions/checkout@v5
with:
path: kubo-gateway
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'kubo-gateway/go.mod'
cache: true
cache-dependency-path: kubo-gateway/go.sum
- name: Build kubo-gateway
run: make build
working-directory: kubo-gateway
@ -133,17 +132,16 @@ jobs:
output: fixtures
# 2. Build the kubo-gateway
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 1.25.x
- uses: protocol/cache-go-action@v1
with:
name: ${{ github.job }}
- name: Checkout kubo-gateway
uses: actions/checkout@v5
with:
path: kubo-gateway
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'kubo-gateway/go.mod'
cache: true
cache-dependency-path: kubo-gateway/go.sum
- name: Build kubo-gateway
run: make build
working-directory: kubo-gateway

View File

@ -21,20 +21,38 @@ jobs:
env:
TEST_DOCKER: 0
TEST_VERBOSE: 1
TRAVIS: 1
GIT_PAGER: cat
IPFS_CHECK_RCMGR_DEFAULTS: 1
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.25.x
- uses: actions/checkout@v5
- run: make cmd/ipfs-try-build
env:
TEST_FUSE: 1
- run: make cmd/ipfs-try-build
env:
TEST_FUSE: 0
go-version-file: 'go.mod'
cache: true
cache-dependency-path: go.sum
- name: Build all platforms
run: |
# Read platforms from build-platforms.yml and build each one
echo "Building kubo for all platforms..."
# Read and build each platform
grep '^ - ' .github/build-platforms.yml | sed 's/^ - //' | while read -r platform; do
if [ -z "$platform" ]; then
continue
fi
echo "::group::Building $platform"
GOOS=$(echo "$platform" | cut -d- -f1)
GOARCH=$(echo "$platform" | cut -d- -f2)
echo "Building $platform"
echo " GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs"
GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs
echo "::endgroup::"
done
echo "All platforms built successfully"

View File

@ -27,7 +27,7 @@ jobs:
submodules: recursive
- uses: actions/setup-go@v6
with:
go-version: "1.25.x"
go-version-file: 'go.mod'
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.4
with:

View File

@ -22,15 +22,14 @@ jobs:
TEST_DOCKER: 0
TEST_FUSE: 0
TEST_VERBOSE: 1
TRAVIS: 1
GIT_PAGER: cat
IPFS_CHECK_RCMGR_DEFAULTS: 1
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: 1.25.x
- uses: actions/checkout@v5
go-version-file: 'go.mod'
- run: make -O test_go_lint

View File

@ -22,19 +22,18 @@ jobs:
TEST_DOCKER: 0
TEST_FUSE: 0
TEST_VERBOSE: 1
TRAVIS: 1
GIT_PAGER: cat
IPFS_CHECK_RCMGR_DEFAULTS: 1
defaults:
run:
shell: bash
steps:
- name: Check out Kubo
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.25.x
- name: Check out Kubo
uses: actions/checkout@v5
go-version-file: 'go.mod'
- name: Install missing tools
run: sudo apt update && sudo apt install -y zsh
- name: 👉️ If this step failed, go to «Summary» (top left) → inspect the «Failures/Errors» table

View File

@ -9,9 +9,6 @@ on:
branches:
- 'master'
env:
GO_VERSION: 1.25.x
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
@ -29,17 +26,16 @@ jobs:
TEST_DOCKER: 0
TEST_FUSE: 0
TEST_VERBOSE: 1
TRAVIS: 1
GIT_PAGER: cat
IPFS_CHECK_RCMGR_DEFAULTS: 1
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v5
go-version-file: 'go.mod'
- run: make build
- uses: actions/upload-artifact@v4
with:
@ -82,7 +78,6 @@ jobs:
LIBP2P_TCP_REUSEPORT: false
LIBP2P_ALLOW_WEAK_RSA_KEYS: 1
E2E_IPFSD_TYPE: go
TRAVIS: 1
GIT_PAGER: cat
IPFS_CHECK_RCMGR_DEFAULTS: 1
defaults:

View File

@ -22,14 +22,14 @@ jobs:
run:
shell: bash
steps:
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 1.25.x
- name: Checkout Kubo
uses: actions/checkout@v5
with:
path: kubo
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'kubo/go.mod'
- name: Install missing tools
run: sudo apt update && sudo apt install -y socat net-tools fish libxml2-utils
- uses: actions/cache@v4

View File

@ -107,8 +107,8 @@ uninstall:
.PHONY: uninstall
supported:
@echo "Currently supported platforms:"
@for p in ${SUPPORTED_PLATFORMS}; do echo $$p; done
@echo "Currently supported platforms (from .github/build-platforms.yml):"
@grep '^ - ' .github/build-platforms.yml | sed 's/^ - //' || (echo "Error: .github/build-platforms.yml not found"; exit 1)
.PHONY: supported
help:
@ -138,7 +138,8 @@ help:
@echo ' test_short - Run short go tests and short sharness tests'
@echo ' test_go_short - Run short go tests'
@echo ' test_go_test - Run all go tests'
@echo ' test_go_expensive - Run all go tests and compile on all platforms'
@echo ' test_go_build - Build kubo for all platforms from .github/build-platforms.yml'
@echo ' test_go_expensive - Run all go tests and build all platforms'
@echo ' test_go_race - Run go tests with the race detector enabled'
@echo ' test_go_lint - Run the `golangci-lint` vetting tool'
@echo ' test_sharness - Run sharness tests'

View File

@ -1,49 +0,0 @@
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
version: "{build}"
os: Windows Server 2012 R2
clone_folder: c:\gopath\src\github.com\ipfs\go-ipfs
environment:
GOPATH: c:\gopath
TEST_VERBOSE: 1
#TEST_NO_FUSE: 1
#TEST_SUITE: test_sharness
#GOFLAGS: -tags nofuse
global:
BASH: C:\cygwin\bin\bash
matrix:
- GOARCH: amd64
GOVERSION: 1.5.1
GOROOT: c:\go
DOWNLOADPLATFORM: "x64"
install:
# Enable make
#- SET PATH=c:\MinGW\bin;%PATH%
#- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
- go version
- go env
# Cygwin build script
#
# NOTES:
#
# The stdin/stdout file descriptor appears not to be valid for the Appveyor
# build which causes failures as certain functions attempt to redirect
# default file handles. Ensure a dummy file descriptor is opened with 'exec'.
#
build_script:
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; export PATH=$GOPATH/bin:$PATH; make nofuse"'
test_script:
- '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null; export PATH=$GOPATH/bin:$PATH; export GOFLAGS=''-tags nofuse''; export TEST_NO_FUSE=1; export TEST_VERBOSE=1; export TEST_EXPENSIVE=1; export TEST_SUITE=test_sharness; make $TEST_SUITE"'
#build:
# parallel: true

24
bin/test-go-build-platforms Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
echo "Building kubo for all platforms in .github/build-platforms.yml..."
if [ ! -f .github/build-platforms.yml ]; then
echo "Error: .github/build-platforms.yml not found"
exit 1
fi
grep '^ - ' .github/build-platforms.yml | sed 's/^ - //' | while read -r platform; do
if [ -z "$platform" ]; then
continue
fi
GOOS=$(echo "$platform" | cut -d- -f1)
GOARCH=$(echo "$platform" | cut -d- -f2)
echo "Building $platform..."
echo " GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs"
GOOS=$GOOS GOARCH=$GOARCH go build -o /dev/null ./cmd/ipfs
done
echo "All platforms built successfully"

View File

@ -2,7 +2,6 @@ include mk/header.mk
IPFS_BIN_$(d) := $(call go-curr-pkg-tgt)
TGT_BIN += $(IPFS_BIN_$(d))
TEST_GO_BUILD += $(d)-try-build
CLEAN += $(IPFS_BIN_$(d))
PATH := $(realpath $(d)):$(PATH)
@ -15,23 +14,12 @@ PATH := $(realpath $(d)):$(PATH)
$(d)_flags =-ldflags="-X "github.com/ipfs/kubo".CurrentCommit=$(git-hash)"
$(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)
$(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)
# uses second expansion to collect all $(DEPS_GO)
$(IPFS_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS #| $(DEPS_OO_$(d))
$(go-build-relative)
TRY_BUILD_$(d)=$(addprefix $(d)-try-build-,$(SUPPORTED_PLATFORMS))
$(d)-try-build: $(TRY_BUILD_$(d))
.PHONY: $(d)-try-build
$(TRY_BUILD_$(d)): PLATFORM = $(subst -, ,$(patsubst $<-try-build-%,%,$@))
$(TRY_BUILD_$(d)): GOOS = $(word 1,$(PLATFORM))
$(TRY_BUILD_$(d)): GOARCH = $(word 2,$(PLATFORM))
$(TRY_BUILD_$(d)): $(d) $$(DEPS_GO) ALWAYS
GOOS=$(GOOS) GOARCH=$(GOARCH) $(go-try-build)
.PHONY: $(TRY_BUILD_$(d))
$(d)-install: GOFLAGS += $(cmd/ipfs_flags)
$(d)-install: $(d) $$(DEPS_GO) ALWAYS
$(GOCC) install $(go-flags-with-tags) ./cmd/ipfs

View File

@ -1,5 +1,4 @@
//go:build linux
// +build linux
package kubo

View File

@ -1,5 +1,4 @@
//go:build !linux
// +build !linux
package kubo

View File

@ -1,5 +1,4 @@
//go:build testrunmain
// +build testrunmain
package main_test

View File

@ -1,5 +1,4 @@
//go:build !wasm
// +build !wasm
package util

View File

@ -1,5 +1,4 @@
//go:build !windows
// +build !windows
package util

View File

@ -1,5 +1,4 @@
//go:build freebsd
// +build freebsd
package util

View File

@ -1,5 +1,4 @@
//go:build !windows && !plan9
// +build !windows,!plan9
package util

View File

@ -1,5 +1,4 @@
//go:build darwin || linux || netbsd || openbsd
// +build darwin linux netbsd openbsd
package util

View File

@ -1,5 +1,4 @@
//go:build windows
// +build windows
package util

View File

@ -1,5 +1,4 @@
//go:build !plan9
// +build !plan9
package main

View File

@ -1,5 +1,4 @@
//go:build !plan9
// +build !plan9
package main

View File

@ -1,5 +1,4 @@
//go:build !windows && nofuse
// +build !windows,nofuse
package commands

View File

@ -1,5 +1,4 @@
//go:build !windows && !nofuse
// +build !windows,!nofuse
package commands

View File

@ -1,5 +1,4 @@
//go:build linux || darwin
// +build linux darwin
package fd

View File

@ -1,5 +1,4 @@
//go:build testrunmain
// +build testrunmain
package main

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !openbsd && !netbsd && !plan9
// +build !nofuse,!openbsd,!netbsd,!plan9
package ipns

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !openbsd && !netbsd && !plan9
// +build !nofuse,!openbsd,!netbsd,!plan9
// package fuse/ipns implements a fuse filesystem that interfaces
// with ipns, the naming system for ipfs.

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !openbsd && !netbsd && !plan9
// +build !nofuse,!openbsd,!netbsd,!plan9
package ipns

View File

@ -1,6 +1,4 @@
//go:build (linux || darwin || freebsd || netbsd || openbsd) && !nofuse
// +build linux darwin freebsd netbsd openbsd
// +build !nofuse
package ipns

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !openbsd && !netbsd && !plan9
// +build !nofuse,!openbsd,!netbsd,!plan9
package mfs

View File

@ -1,6 +1,4 @@
//go:build (linux || darwin || freebsd || netbsd || openbsd) && !nofuse
// +build linux darwin freebsd netbsd openbsd
// +build !nofuse
package mfs

View File

@ -1,6 +1,4 @@
//go:build (linux || darwin || freebsd || netbsd || openbsd) && !nofuse
// +build linux darwin freebsd netbsd openbsd
// +build !nofuse
package mfs

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !windows && !openbsd && !netbsd && !plan9
// +build !nofuse,!windows,!openbsd,!netbsd,!plan9
package mount

View File

@ -1,5 +1,4 @@
//go:build !nofuse
// +build !nofuse
//go:build !nofuse && darwin
package node

View File

@ -1,5 +1,4 @@
//go:build !windows && nofuse
// +build !windows,nofuse
package node

View File

@ -1,5 +1,4 @@
//go:build (!nofuse && openbsd) || (!nofuse && netbsd) || (!nofuse && plan9)
// +build !nofuse,openbsd !nofuse,netbsd !nofuse,plan9
package node

View File

@ -1,5 +1,4 @@
//go:build !openbsd && !nofuse && !netbsd && !plan9
// +build !openbsd,!nofuse,!netbsd,!plan9
package node

View File

@ -1,5 +1,4 @@
//go:build !windows && !openbsd && !netbsd && !plan9 && !nofuse
// +build !windows,!openbsd,!netbsd,!plan9,!nofuse
package node

View File

@ -1,5 +1,4 @@
//go:build !nofuse && !openbsd && !netbsd && !plan9
// +build !nofuse,!openbsd,!netbsd,!plan9
package readonly

View File

@ -1,6 +1,4 @@
//go:build (linux || darwin || freebsd) && !nofuse
// +build linux darwin freebsd
// +build !nofuse
package readonly

View File

@ -1,6 +1,4 @@
//go:build (linux || darwin || freebsd) && !nofuse
// +build linux darwin freebsd
// +build !nofuse
package readonly

View File

@ -42,15 +42,14 @@ define go-build
$(GOCC) build $(go-flags-with-tags) -o "$@" "$(1)"
endef
define go-try-build
$(GOCC) build $(go-flags-with-tags) -o /dev/null "$(call go-pkg-name,$<)"
endef
test_go_test: $$(DEPS_GO)
$(GOCC) test $(go-flags-with-tags) $(GOTFLAGS) ./...
.PHONY: test_go_test
test_go_build: $$(TEST_GO_BUILD)
# Build all platforms from .github/build-platforms.yml
test_go_build:
bin/test-go-build-platforms
.PHONY: test_go_build
test_go_short: GOTFLAGS += -test.short
test_go_short: test_go_test

View File

@ -9,26 +9,9 @@ else
PATH_SEP :=:
endif
SUPPORTED_PLATFORMS += windows-386
SUPPORTED_PLATFORMS += windows-amd64
SUPPORTED_PLATFORMS += linux-arm
SUPPORTED_PLATFORMS += linux-arm64
SUPPORTED_PLATFORMS += linux-386
SUPPORTED_PLATFORMS += linux-amd64
SUPPORTED_PLATFORMS += darwin-amd64
ifeq ($(shell bin/check_go_version "1.16.0" 2>/dev/null; echo $$?),0)
SUPPORTED_PLATFORMS += darwin-arm64
endif
SUPPORTED_PLATFORMS += freebsd-386
SUPPORTED_PLATFORMS += freebsd-amd64
SUPPORTED_PLATFORMS += openbsd-386
SUPPORTED_PLATFORMS += openbsd-amd64
SUPPORTED_PLATFORMS += netbsd-386
SUPPORTED_PLATFORMS += netbsd-amd64
# Platforms are now defined in .github/build-platforms.yml
# The cmd/ipfs-try-build target is deprecated in favor of GitHub Actions
# Use 'make supported' to see the list of platforms
space:=$() $()
comma:=,

View File

@ -1,7 +1,4 @@
//go:build !cgo && !noplugin && (linux || darwin || freebsd)
// +build !cgo
// +build !noplugin
// +build linux darwin freebsd
package loader

View File

@ -1,5 +1,4 @@
//go:build noplugin
// +build noplugin
package loader

View File

@ -1,7 +1,4 @@
//go:build cgo && !noplugin && (linux || darwin || freebsd)
// +build cgo
// +build !noplugin
// +build linux darwin freebsd
package loader

View File

@ -1,5 +1,4 @@
//go:build tools
// +build tools
package tools