From 5ec3bb902ed119f4e3253a82889f2b718849e8af Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 11 Sep 2023 19:10:21 +0200 Subject: [PATCH 1/5] build(meta_update): Add new option `--outdir` --- meta_update.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta_update.py b/meta_update.py index c7e49c48f..c5ff5026b 100755 --- a/meta_update.py +++ b/meta_update.py @@ -139,6 +139,7 @@ def main(): parser = ArgumentParser(description='Update codemeta.json and ' '.zenodo.json') parser.add_argument('--set-version', dest='newversion') + parser.add_argument('--outdir', dest='outdir') args = parser.parse_args() for manipulator in (CodeMetaManipulator(), ZenodoManipulator()): @@ -150,7 +151,10 @@ def main(): if args.newversion is not None: manipulator.version(args.newversion) manipulator.update_authors() - manipulator.save() + filename = None + if args.outdir is not None: + filename = f'{args.outdir}/{manipulator.default_filename}' + manipulator.save(filename) if __name__ == '__main__': From a736ec7e40c673d0f63220e66d09f6cc3c801279 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 11 Sep 2023 19:11:37 +0200 Subject: [PATCH 2/5] build: Add new target `codemeta` to generate `codemeta.json` --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 428625b5f..ed341c2d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,11 @@ endif() if(BUILD_TIDY_TOOL) add_subdirectory(fairmq/tidy) endif() + +add_custom_target(codemeta + python3 ${CMAKE_SOURCE_DIR}/meta_update.py --outdir ${CMAKE_BINARY_DIR} --set-version ${PROJECT_VERSION} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + VERBATIM USES_TERMINAL) ################################################################################ From 64d1f41f563f4a20bf46bc64f82831953644128b Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 11 Sep 2023 20:49:07 +0200 Subject: [PATCH 3/5] ci: Install Python in dev environment --- test/ci/Containerfile.fedora | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ci/Containerfile.fedora b/test/ci/Containerfile.fedora index 6e9f6017e..4cf8c1c7f 100644 --- a/test/ci/Containerfile.fedora +++ b/test/ci/Containerfile.fedora @@ -6,7 +6,7 @@ LABEL org.opencontainers.image.description "FairMQ development environment" RUN dnf -y update # https://git.gsi.de/SDE/packages/builder RUN dnf -y install https://alfa-ci.gsi.de/packages/rpm/fedora-$VERSION-x86_64/fairsoft-release-dev.rpm -RUN dnf -y install clang cli11-devel ninja-build 'dnf-command(builddep)' libasan liblsan libtsan libubsan clang-tools-extra +RUN dnf -y install clang cli11-devel ninja-build 'dnf-command(builddep)' libasan liblsan libtsan libubsan clang-tools-extra python3 RUN dnf -y builddep fairmq RUN dnf -y clean all From ff8079bbcb5a23de4fdfa6538ada6eef0bbd09f5 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 11 Sep 2023 19:09:44 +0200 Subject: [PATCH 4/5] ci: Generate `codemeta.json` --- .github/workflows/codemeta.yaml | 46 ++++++++++++++++++++++++ .github/workflows/codemeta_validate.yaml | 21 ----------- 2 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/codemeta.yaml delete mode 100644 .github/workflows/codemeta_validate.yaml diff --git a/.github/workflows/codemeta.yaml b/.github/workflows/codemeta.yaml new file mode 100644 index 000000000..62179671f --- /dev/null +++ b/.github/workflows/codemeta.yaml @@ -0,0 +1,46 @@ +name: codemeta + +on: + push: + paths: + - codemeta.json + - .github/workflows/codemeta.yaml + tags: + - 'v*' + pull_request: + paths: + - codemeta.json + - .github/workflows/codemeta.yaml + +jobs: + generate: + runs-on: ubuntu-latest + container: + image: ghcr.io/fairrootgroup/fairmq-dev/fedora-38:latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 150 + fetch-tags: true + - run: "git config --system --add safe.directory $GITHUB_WORKSPACE" + - name: configure + run: "cmake -G Ninja -S $GITHUB_WORKSPACE -B build" + - name: generate codemeta.json + run: cmake --build build --target codemeta + - name: print result + run: cat build/codemeta.json + - uses: actions/upload-artifact@v3 + with: + name: codemeta.json + path: build/codemeta.json + validate: + needs: generate + runs-on: ubuntu-latest + container: + image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v1.0 + steps: + - uses: actions/download-artifact@v3 + with: + name: codemeta.json + - name: validate codemeta + run: eossr-metadata-validator codemeta.json diff --git a/.github/workflows/codemeta_validate.yaml b/.github/workflows/codemeta_validate.yaml deleted file mode 100644 index 46a7b0c00..000000000 --- a/.github/workflows/codemeta_validate.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: validate codemeta - -on: - push: - paths: - - codemeta.json - - .github/workflows/codemeta_validate.yaml - pull_request: - paths: - - codemeta.json - - .github/workflows/codemeta_validate.yaml - -jobs: - build: - runs-on: ubuntu-latest - container: - image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v1.0 - steps: - - uses: actions/checkout@v3 - - name: validate codemeta - run: eossr-metadata-validator codemeta.json From 42d51a1067bd2b5ca13c47ba1a1778c2a7b282ca Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Mon, 11 Sep 2023 21:14:05 +0200 Subject: [PATCH 5/5] ci: Publish `codemeta.json` as release asset --- .github/workflows/codemeta.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/codemeta.yaml b/.github/workflows/codemeta.yaml index 62179671f..c6b3a07f5 100644 --- a/.github/workflows/codemeta.yaml +++ b/.github/workflows/codemeta.yaml @@ -44,3 +44,14 @@ jobs: name: codemeta.json - name: validate codemeta run: eossr-metadata-validator codemeta.json + publish: + needs: validate + runs-on: ubuntu-latest + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v3 + with: + name: codemeta.json + - uses: svenstaro/upload-release-action@v2 + with: + file: codemeta.json