Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate codemeta.json #483

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/codemeta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: codemeta

on:
push:
paths:
- codemeta.json
- .github/workflows/codemeta.yaml
tags:
- 'v*'
Comment on lines +5 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the semantics (AND) compared to the "old" validate workflow. Please comment on this in the commit text body. :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, ye, will revisit this. thought it was OR logic.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe?

Suggested change
run: cat build/codemeta.json
run: diff codemeta.json 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
ChristianTackeGSI marked this conversation as resolved.
Show resolved Hide resolved
publish:
needs: validate
Comment on lines +47 to +48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, now you have the dep. Maybe do the moving of the validate step in this commit instead?

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
21 changes: 0 additions & 21 deletions .github/workflows/codemeta_validate.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect a find_package(2)(Python … something interpreter) for this, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, was considering it, but there was so much noise with CMake's Python detection in the past that I am afraid it will introduce more maintenance work than hardcoding it - this target really does not need to be super platform independent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, got that! Please add a comment above it to that fact. Something like "meant for release management, not needed to be as portable".

Have you looked into add_custom_command(OUTPUT … MAIN_DEPENDENCY …) or the SOURCES part of add_custom_target?

WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM USES_TERMINAL)
################################################################################


Expand Down
6 changes: 5 additions & 1 deletion meta_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand All @@ -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}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a pathlib.Path based approach for this. Yes, not needed for us. But still nicer?

manipulator.save(filename)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion test/ci/Containerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down