diff --git a/.github/workflows/codemeta.yaml b/.github/workflows/codemeta.yaml new file mode 100644 index 000000000..c6b3a07f5 --- /dev/null +++ b/.github/workflows/codemeta.yaml @@ -0,0 +1,57 @@ +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 + 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 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 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) ################################################################################ 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__': 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