Skip to content

chore: repo standards #48

chore: repo standards

chore: repo standards #48

Workflow file for this run

# Copyright (c) 2025-2026 ADBC Drivers Contributors
#
# Licensed 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.
# !!!! AUTO-GENERATED FILE. DO NOT EDIT. !!!!
# USE adbc-gen-workflow (see adbc-drivers/dev) TO UPDATE THIS FILE.
# This is a common workflow for building & testing drivers:
#
# - Build the driver
# - Start dependencies
# - Run tests
# - Build the shared library
name: Custom Test
on:
pull_request:
branches:
- main
paths:
- "**"
- .github/workflows/script_test.yaml
push:
branches:
- main
paths:
- "**"
- .github/workflows/script_test.yaml
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
test:
name: "Test/${{ matrix.platform }}_${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: true
matrix:
include:
- { platform: linux, arch: amd64, runner: ubuntu-latest }
- { platform: macos, arch: arm64, runner: macos-latest }
- { platform: windows, arch: amd64, runner: windows-latest }
permissions:
contents: read
steps:
- name: free up disk space
if: runner.os != 'Windows'
run: |
# Preinstalled tools use a lot of disk space, free up some space
# https://github.com/actions/runner-images/issues/2840
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
submodules: 'recursive'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- name: Build
working-directory: .
run: |
if [[ -f ci/scripts/pre-build.sh ]]; then
echo "Loading pre-build"
./ci/scripts/pre-build.sh test ${{ matrix.platform }} ${{ matrix.arch }}
fi
set -a
if [[ -f .env.build ]]; then
echo "Loading .env.build"
source .env.build
fi
set +a
./ci/scripts/build.sh test ${{ matrix.platform }} ${{ matrix.arch }}
- name: Start Test Dependencies
# Can't use Docker on macOS AArch64 runners, and Windows containers
# work but often the container doesn't support Windows
if: runner.os == 'Linux'
working-directory: .
run: |
if [[ -f compose.yaml ]]; then
if ! docker compose up --detach --wait test-service; then
echo "Service failed to start"
echo "Logs:"
docker compose logs test-service
exit 1
fi
fi
- name: Test
working-directory: .
run: |
set -a
if [[ -f .env ]]; then
source .env
fi
if [[ -f .env.${{ matrix.platform }} ]]; then
source .env.${{ matrix.platform }}
fi
if [[ -f .env.ci ]]; then
source .env.ci
fi
set +a
if [[ -f ci/scripts/pre-test.sh ]]; then
echo "Loading pre-test"
./ci/scripts/pre-test.sh ${{ matrix.platform }} ${{ matrix.arch }}
fi
./ci/scripts/test.sh ${{ matrix.platform }} ${{ matrix.arch }}
if [[ -f ci/scripts/post-test.sh ]]; then
./ci/scripts/post-test.sh
fi
validate:
name: "Validate quack ${{ matrix.vendor_version }}/${{ matrix.platform }}_${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: true
matrix:
include:
# I think we only need to test one platform, but we can change that later
- { platform: linux, arch: amd64, runner: ubuntu-latest, service_name: "test-service", vendor_version: "1.5" }
permissions:
contents: read
steps:
- name: free up disk space
if: runner.os != 'Windows'
run: |
# Preinstalled tools use a lot of disk space, free up some space
# https://github.com/actions/runner-images/issues/2840
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
submodules: 'recursive'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- name: Log in to ghcr.io
if: runner.os == 'Linux'
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "$GHCR_TOKEN" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
- name: Build Library
working-directory: .
run: |
if [[ -f ci/scripts/pre-build.sh ]]; then
./ci/scripts/pre-build.sh test ${{ matrix.platform }} ${{ matrix.arch }}
fi
set -a
if [[ -f .env.build ]]; then
echo "Loading .env.build"
source .env.build
fi
if [[ -f .env.test ]]; then
source .env.test
fi
set +a
pixi run adbc-make build DEBUG=true VERBOSE=true DRIVER=quack IMPL_LANG=script TOOLCHAIN=cpp MANYLINUX=manylinux_2_28
- name: Start Test Dependencies
# Can't use Docker on macOS AArch64 runners, and Windows containers
# work but often the container doesn't support Windows
if: runner.os == 'Linux'
working-directory: .
run: |
if [[ -f compose.yaml ]]; then
if ! docker compose up --detach --wait ${{ matrix.service_name }}; then
echo "Service failed to start"
echo "Logs:"
docker compose logs ${{ matrix.service_name }}
exit 1
fi
fi
- name: Validate
if: runner.os == 'Linux'
working-directory: .
run: |
set -a
if [[ -f .env ]]; then
source .env
fi
if [[ -f .env.${{ matrix.platform }} ]]; then
source .env.${{ matrix.platform }}
fi
if [[ -f .env.ci ]]; then
source .env.ci
fi
set +a
if [[ -f ci/scripts/pre-test.sh ]]; then
echo "Loading pre-test"
./ci/scripts/pre-test.sh ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.service_name }}
fi
docker ps
if [[ -n "${{ matrix.vendor_version }}" ]]; then
pixi run validate --vendor-version "${{ matrix.vendor_version }}"
else
pixi run validate
fi
if [[ -f ci/scripts/post-test.sh ]]; then
./ci/scripts/post-test.sh
fi
cp validation-report.xml validation-report-${{ matrix.vendor_version }}.xml
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: validation-report-${{ matrix.vendor_version }}
path: "./validation-report-${{ matrix.vendor_version }}.xml"
retention-days: 7
- name: Generate docs
working-directory: .
run: |
pixi run gendocs --output generated
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: docs-${{ matrix.vendor_version }}
path: "./generated/quack.md"
retention-days: 7
build:
name: "Build quack/${{ matrix.platform }}_${{ matrix.arch }}"
needs: test
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: true
matrix:
include:
- { platform: linux, arch: amd64, runner: ubuntu-latest }
- { platform: linux, arch: arm64, runner: ubuntu-24.04-arm }
- { platform: macos, arch: arm64, runner: macos-latest }
- { platform: windows, arch: amd64, runner: windows-latest }
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
submodules: 'recursive'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- name: Install dev tools
working-directory: .
run: |
pixi install
- name: Log in to ghcr.io
if: runner.os == 'Linux'
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "$GHCR_TOKEN" | docker login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin
- name: Build Library
working-directory: .
run: |
if [[ -f ci/scripts/pre-build.sh ]]; then
./ci/scripts/pre-build.sh release ${{ matrix.platform }} ${{ matrix.arch }}
fi
set -a
if [[ -f .env.build ]]; then
echo "Loading .env.build"
source .env.build
fi
if [[ -f .env.release ]]; then
source .env.release
fi
set +a
pixi run adbc-make check CI=true VERBOSE=true DRIVER=quack IMPL_LANG=script TOOLCHAIN=cpp MANYLINUX=manylinux_2_28
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: drivers-${{ matrix.platform }}-${{ matrix.arch }}
path: "./build/libadbc_driver_quack.*"
retention-days: 2
package:
name: "Generate Packages"
runs-on: ubuntu-latest
needs:
- build
- validate
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
submodules: 'recursive'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "drivers-*"
path: "~/drivers"
- name: Install tools
working-directory: .
run: |
- name: Generate packages
working-directory: .
run: |
pixi install
pixi run adbc-gen-package \
--name quack \
--root $(pwd) \
--manifest-template $(pwd)/manifest.toml \
\
-o ~/packages \
~/drivers/drivers-*-*/
ls ~/packages
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: all-packages
path: ~/packages
retention-days: 7
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: "validation-report-*"
path: "~/validation-report"
- name: Generate combined docs
working-directory: .
run: |
ls -laR ~/validation-report
find ~/validation-report -type f -name '*.xml'
cp $(find ~/validation-report -type f -name '*.xml') .
ls *.xml
pixi run gendocs --output generated
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: docs
path: "./generated/quack.md"
retention-days: 2
test-packages:
name: "Test Packages/${{ matrix.platform }}_${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
needs:
- package
strategy:
fail-fast: false
matrix:
include:
- { platform: linux, arch: amd64, runner: ubuntu-latest }
- { platform: macos, arch: arm64, runner: macos-latest }
- { platform: windows, arch: amd64, runner: windows-latest }
steps:
# for now, install dbc from main
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
cache: true
go-version: 'stable'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: "all-packages"
path: "~/packages"
- name: install package
# dbc uses the filename as the driver name
run: |
echo "Installing dbc"
git clone --depth 1 https://github.com/columnar-tech/dbc
cd dbc
go build ./cmd/dbc
echo "Installed dbc"
ls -laR ~/packages
driver_pkg=$(find ~/packages -name '*_${{ matrix.platform }}_${{ matrix.arch }}_*.tar.gz')
echo "Installing ${driver_pkg}"
./dbc install --no-verify "${driver_pkg}"
echo "Installed ${driver_pkg}"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
submodules: 'recursive'
- name: load package
working-directory: .
run: |
if [[ -f ci/scripts/pre-build.sh ]]; then
echo "Loading pre-build"
./ci/scripts/pre-build.sh test ${{ matrix.platform }} ${{ matrix.arch }}
fi
set -a
if [[ -f .env.build ]]; then
echo "Loading .env.build"
source .env.build
fi
if [[ -f .env.ci ]]; then
source .env.ci
fi
set +a
pixi exec -s adbc-driver-manager -s pyarrow -s pytest python -m pytest -vs ci/test_package.py
release:
name: "Release (Dry Run)"
runs-on: ubuntu-latest
needs:
- package
- test-packages
- validate
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
submodules: 'recursive'
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
with:
pixi-version: v0.63.2
run-install: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: "all-packages"
path: "~/packages"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: "docs"
path: "~/packages"
- name: Release (dry-run)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: .
run: |
git tag v1000.0.0
tag=v1000.0.0
pixi run release --dry-run $(pwd) $tag
echo gh release upload $tag $(find ~/packages -name '*.tar.gz') $(find ~/packages -name 'manifest.yaml') $(find ~/packages -name '*.md')