Skip to content

perf(metadata): avoid re-cloning defensive schema copies #6214

perf(metadata): avoid re-cloning defensive schema copies

perf(metadata): avoid re-cloning defensive schema copies #6214

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Go
on:
push:
branches:
- 'main'
pull_request:
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
lint-and-test:
name: ${{ matrix.os }} go${{ matrix.go }}
runs-on: ${{ matrix.os }}
# Cache dirs are pinned to dot-prefixed paths under the workspace so they are
# identical across Linux/Windows/macOS (no per-OS path branching) and are
# excluded from `go`/golangci-lint `./...` expansion (leading-dot dirs are
# ignored). Go and golangci-lint honor these env vars for their cache dirs.
env:
GOMODCACHE: ${{ github.workspace }}/.gocache/mod
GOCACHE: ${{ github.workspace }}/.gocache/build
GOLANGCI_LINT_CACHE: ${{ github.workspace }}/.gocache/golangci
strategy:
max-parallel: 15
fail-fast: false
matrix:
go: [ '1.25.9', '1.26.1' ]
os:
- 'ubuntu-latest'
- 'macos-latest'
# - 'windows-latest' # blocked on Windows path support, see #1262
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go }}
# Caching is managed explicitly below so saves can be gated to main and
# the golangci-lint cache can be keyed by Go version.
cache: false
# Restore is unconditional (PRs read main's caches); save is gated to main.
- name: Restore Go module and build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ github.workspace }}/.gocache/mod
${{ github.workspace }}/.gocache/build
key: go-${{ matrix.os }}-go${{ matrix.go }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-${{ matrix.os }}-go${{ matrix.go }}-
- name: Restore golangci-lint cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ github.workspace }}/.gocache/golangci
key: golangci-${{ matrix.os }}-go${{ matrix.go }}-${{ hashFiles('go.sum', '.golangci.yml') }}
restore-keys: |
golangci-${{ matrix.os }}-go${{ matrix.go }}-
- name: Run golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2
args: --timeout=10m
# The action's own cache key omits the Go version, so all matrix cells
# collide on one entry; we manage the cache explicitly above instead.
skip-cache: true
- name: Run tests with race detector
run: make test-race
- name: Run Arrow ownership assertions
if: matrix.os == 'ubuntu-latest' && matrix.go == '1.26.1'
run: make test-assert
- name: Save Go module and build cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ github.workspace }}/.gocache/mod
${{ github.workspace }}/.gocache/build
key: go-${{ matrix.os }}-go${{ matrix.go }}-${{ hashFiles('go.sum') }}
- name: Save golangci-lint cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ github.workspace }}/.gocache/golangci
key: golangci-${{ matrix.os }}-go${{ matrix.go }}-${{ hashFiles('go.sum', '.golangci.yml') }}
# Guards against big-endian-only failures such as the runtime.staticuint64s
# relocation misalignment triggered by boxing scalars in generic code
# (golang/go#76744). The fault is a linker error and only s390x's linker
# rejects the misaligned relocation, so this must build a main package for
# s390x specifically rather than just vet or compile libraries.
cross-compile:
name: cross-compile linux/s390x
runs-on: ubuntu-latest
env:
GOMODCACHE: ${{ github.workspace }}/.gocache/mod
GOCACHE: ${{ github.workspace }}/.gocache/build
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: '1.26.1'
cache: false
- name: Restore Go module and build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ github.workspace }}/.gocache/mod
${{ github.workspace }}/.gocache/build
key: go-cross-s390x-${{ hashFiles('go.sum') }}
restore-keys: |
go-cross-s390x-
- name: Build for big-endian (s390x)
env:
GOOS: linux
GOARCH: s390x
CGO_ENABLED: '0'
run: go build ./...
- name: Save Go module and build cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ github.workspace }}/.gocache/mod
${{ github.workspace }}/.gocache/build
key: go-cross-s390x-${{ hashFiles('go.sum') }}