Skip to content

Commit

Permalink
Merge pull request #81 from carlopi/test_all
Browse files Browse the repository at this point in the history
Add workflow to build and test all current extensions vs a given duckdb version
  • Loading branch information
carlopi authored Aug 28, 2024
2 parents fbb9af6 + ff64173 commit 246e08d
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ on:
inputs:
extension_name:
type: string
duckdb_version:
type: string
deploy:
type: string
more_excluded:
type: string
workflow_call:
inputs:
extension_name:
type: string
duckdb_version:
type: string
deploy:
type: string
more_excluded:
type: string

jobs:
prepare:
Expand All @@ -24,11 +40,14 @@ jobs:
COMMUNITY_EXTENSION_GITHUB: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_GITHUB }}
COMMUNITY_EXTENSION_REF: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_REF }}
COMMUNITY_EXTENSION_DEPLOY: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_DEPLOY }}
COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS }}
COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS: ${{ inputs.more_excluded }}${{ steps.parse.outputs.COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS }}
COMMUNITY_EXTENSION_REQUIRES_TOOLCHAINS: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_REQUIRES_TOOLCHAINS }}
COMMUNITY_EXTENSION_CUSTOM_TOOLCHAIN_SCRIPT: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_CUSTOM_TOOLCHAIN_SCRIPT }}
COMMUNITY_EXTENSION_VCPKG_URL: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_VCPKG_URL == '' && 'https://github.com/microsoft/vcpkg.git' || steps.parse.outputs.COMMUNITY_EXTENSION_VCPKG_URL }}
COMMUNITY_EXTENSION_VCPKG_COMMIT: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_VCPKG_COMMIT == '' && 'a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6' || steps.parse.outputs.COMMUNITY_EXTENSION_VCPKG_COMMIT }}
env:
DUCKDB_LATEST_STABLE: 'v1.0.0'
DUCKDB_VERSION: ${{ inputs.duckdb_version || 'v1.0.0' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -48,6 +67,7 @@ jobs:
ALL_CHANGED_FILES: ${{ github.event_name == 'workflow_dispatch' && format('extensions/{0}/description.yml', inputs.extension_name) || steps.changed-files.outputs.all_changed_files }}
run: |
pip install pyyaml
# scripts/build.py takes DUCKDB_VERSION from environment
python scripts/build.py
cat env.sh >> $GITHUB_OUTPUT
echo `cat $GITHUB_OUTPUT`
Expand All @@ -57,7 +77,7 @@ jobs:
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main
if: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_NAME != '' }}
with:
duckdb_version: v1.0.0
duckdb_version: ${{ inputs.duckdb_version || 'v1.0.0' }}
exclude_archs: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS }}
extra_toolchains: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_REQUIRES_TOOLCHAINS }}
custom_toolchain_script: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_CUSTOM_TOOLCHAIN_SCRIPT == 'true'}}
Expand All @@ -68,6 +88,7 @@ jobs:
vcpkg_commit: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_VCPKG_COMMIT}}

doc_test:
if: ${{ inputs.deploy != 'false' }}
needs:
- prepare
- build
Expand All @@ -85,7 +106,7 @@ jobs:
secrets: inherit
with:
deploy_latest: true
duckdb_version: v1.0.0
duckdb_version: ${{ inputs.duckdb_version || 'v1.0.0' }}
exclude_archs: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_EXCLUDE_PLATFORMS }}
extension_name: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_NAME }}
repository: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_GITHUB }}
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/test_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test all extensions
on:
workflow_dispatch:
inputs:
duckdb_version:
type: string

jobs:
collect_extensions:
outputs:
COMMUNITY_EXTENSION_LIST: ${{ steps.generate_list.outputs.EXTENSION_LIST }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate extension list
id: generate_list
run: |
./scripts/get_extension_list.sh
cat extension_list
cat extension_list >> $GITHUB_OUTPUT
test_all:
needs:
- collect_extensions
strategy:
fail-fast: false
matrix:
extension_name: ${{ fromJson(needs.collect_extensions.outputs.COMMUNITY_EXTENSION_LIST) }}
uses: ./.github/workflows/build.yml
with:
extension_name: ${{ matrix.extension_name }}
duckdb_version: ${{ inputs.duckdb_version }}
deploy: 'false'
more_excluded: 'windows_amd64_rtools;windows_amd64;wasm_threads;wasm_mvp;linux_arm64;linux_amd64;osx_arm64'
6 changes: 5 additions & 1 deletion scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

with open('env.sh', 'w+') as hdl:
hdl.write(f"COMMUNITY_EXTENSION_GITHUB={desc['repo']['github']}\n")
hdl.write(f"COMMUNITY_EXTENSION_REF={desc['repo']['ref']}\n")
extension_ref = desc['repo']['ref']
if os.environ['DUCKDB_VERSION'] != os.environ['DUCKDB_LATEST_STABLE']:
if 'ref_next' in desc['repo']:
extension_ref = desc['repo']['ref_next']
hdl.write(f"COMMUNITY_EXTENSION_REF={extension_ref}\n")
hdl.write(f"COMMUNITY_EXTENSION_NAME={desc['extension']['name']}\n")
excluded_platforms = desc['extension'].get('excluded_platforms')
requires_toolchains = desc['extension'].get('requires_toolchains')
Expand Down
9 changes: 9 additions & 0 deletions scripts/get_extension_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -eo pipefail

echo -n "EXTENSION_LIST=[" > extension_list
for extension_folder in extensions/*;
do
extension_name=$(basename -- $extension_folder)
echo -n "'$extension_name'," >> extension_list
done
echo "]" >> extension_list

0 comments on commit 246e08d

Please sign in to comment.