From 9675ffd9af13ac8793da402a3135f1001a1444b5 Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Thu, 13 Jun 2024 14:14:22 +0200 Subject: [PATCH] add scrooge --- .github/workflows/build.yml | 9 +++++---- extensions/scrooge/description.yaml | 14 ++++++++++++++ scripts/build.py | 22 ++++++++++++++++++++-- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 extensions/scrooge/description.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf79e5f..a01a32c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,10 @@ jobs: COMMUNITY_EXTENSION_REF: ${{ steps.parse.outputs.COMMUNITY_EXTENSION_REF }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get all changed description files id: changed-files uses: tj-actions/changed-files@v44 @@ -18,10 +22,6 @@ jobs: files: | extensions/*/description.yml - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Parse description files id: parse env: @@ -35,6 +35,7 @@ jobs: build: needs: prepare uses: ./.github/workflows/_extension_distribution.yml + if: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_NAME != '' }} with: duckdb_version: v1.0.0 extension_name: ${{ needs.prepare.outputs.COMMUNITY_EXTENSION_NAME }} diff --git a/extensions/scrooge/description.yaml b/extensions/scrooge/description.yaml new file mode 100644 index 0000000..db4760a --- /dev/null +++ b/extensions/scrooge/description.yaml @@ -0,0 +1,14 @@ +extension: + name: scrooge + description: Provides functionality for financial data-analysis + version: 0.0.1 + language: C++ + build: cmake + license: MIT + maintainers: + - pdet + + +repo: + github: pdet/Scrooge-McDuck + ref: 92a24d951fbbc7bbf6f7978726c71871608a8c23 \ No newline at end of file diff --git a/scripts/build.py b/scripts/build.py index 0d493f8..1739070 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -1,12 +1,30 @@ import os +import sys import yaml # TODO: check prefix, needs to be in installation dir -desc_files = os.environ['ALL_CHANGED_FILES'].split(' ') -if len(desc_files) != 1: +if 'ALL_CHANGED_FILES' in os.environ: + desc_files = os.environ['ALL_CHANGED_FILES'].split(' ') +else: + desc_files = [] + +print(f"Files changed: {desc_files}") + +if len(desc_files) > 1: raise ValueError('cannot have multiple descriptors changed or packages with spaces in their names') + +if len(desc_files) == 0 or len(desc_files[0]) == 0: + print("No changed files, nothing will be built") + with open('env.sh', 'w+') as hdl: + hdl.write(f"COMMUNITY_EXTENSION_GITHUB=\n") + hdl.write(f"COMMUNITY_EXTENSION_REF=\n") + hdl.write(f"COMMUNITY_EXTENSION_NAME=\n") + sys.exit(os.EX_OK) + desc_file = desc_files[0] +if len(desc_file) == 0: + raise ValueError('description file not found (ALL_CHANGED_FILES was set but empty)') with open(desc_file, 'r') as stream: desc = yaml.safe_load(stream)