From f887e212876f8db76f8a9a61837b65760eabf8d5 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:18:13 +0100 Subject: [PATCH 01/10] fix issue with validator step The command name was incorrect, replacing with eossr-zenodo-metadata-validator --- .github/workflows/test.yml | 10 ++++++++ entrypoint.sh | 2 +- tests/test_entrypoint.sh | 51 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 920c12d..840f53a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,16 @@ jobs: chmod +x tests/test_entrypoint.sh bash tests/test_entrypoint.sh + - name: Run shell tests in action container (real tools) + run: | + docker build -t codemeta2zenodo-test . + docker run --rm \ + -v "${PWD}":/github/workspace \ + -w /github/workspace \ + --entrypoint bash \ + codemeta2zenodo-test \ + tests/test_entrypoint.sh --require-e2e + - name: Validate metadata files run: | echo "Validating metadata files..." diff --git a/entrypoint.sh b/entrypoint.sh index 534ac7e..f4469df 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,7 +44,7 @@ fi # Validate the generated .zenodo.json file echo "::group::Validating .zenodo.json" -if ! eossr-zenodo-validator "${ZENODO_FILE}"; then +if ! eossr-zenodo-metadata-validator "${ZENODO_FILE}"; then echo "::error::Validation failed for ${ZENODO_FILE}" exit 1 fi diff --git a/tests/test_entrypoint.sh b/tests/test_entrypoint.sh index 8da5c82..a6fa06c 100755 --- a/tests/test_entrypoint.sh +++ b/tests/test_entrypoint.sh @@ -18,6 +18,12 @@ NC='\033[0m' # No Color TESTS_RUN=0 TESTS_PASSED=0 TESTS_FAILED=0 +TESTS_SKIPPED=0 +REQUIRE_E2E=false + +if [ "${1:-}" = "--require-e2e" ]; then + REQUIRE_E2E=true +fi # Test helper functions setup_test_dir() { @@ -72,6 +78,11 @@ test_failed() { echo -e "${RED}✗ Test failed${NC}" } +test_skipped() { + TESTS_SKIPPED=$((TESTS_SKIPPED + 1)) + echo -e "${YELLOW}- Test skipped${NC}" +} + # Create a minimal valid codemeta.json for testing create_test_codemeta() { local filename=${1:-codemeta.json} @@ -168,6 +179,44 @@ test_fixture_validity() { fi } +# Test 5: Run the real entrypoint end-to-end with real eossr tools +test_real_entrypoint_e2e() { + run_test "Test 5: Real entrypoint end-to-end" + TEST_DIR=$(setup_test_dir) + + create_test_codemeta "codemeta.json" + + if ! command -v eossr-codemeta2zenodo >/dev/null 2>&1 || ! command -v eossr-zenodo-metadata-validator >/dev/null 2>&1; then + if [ "$REQUIRE_E2E" = "true" ]; then + echo "eossr commands are not available but --require-e2e was requested" + cleanup_test_dir + test_failed + return 1 + fi + echo "Skipping real E2E test because eossr commands are not available in this environment" + cleanup_test_dir + test_skipped + return 0 + fi + + if bash "$ENTRYPOINT" "codemeta.json" "true" "false"; then + if assert_file_exists ".zenodo.json"; then + cleanup_test_dir + test_passed + return 0 + else + cleanup_test_dir + test_failed + return 1 + fi + else + echo "Entrypoint failed during real E2E test" + cleanup_test_dir + test_failed + return 1 + fi +} + # Main test execution echo "========================================" echo "CodeMeta2Zenodo Action Test Suite" @@ -178,6 +227,7 @@ test_script_syntax test_script_executable test_missing_input test_fixture_validity +test_real_entrypoint_e2e # Summary echo "" @@ -186,6 +236,7 @@ echo "Test Summary" echo "========================================" echo -e "Tests run: $TESTS_RUN" echo -e "${GREEN}Tests passed: $TESTS_PASSED${NC}" +echo -e "${YELLOW}Tests skipped: $TESTS_SKIPPED${NC}" if [ $TESTS_FAILED -gt 0 ]; then echo -e "${RED}Tests failed: $TESTS_FAILED${NC}" else From 566bd78014fb776003dab1b01ba47afaec2d608e Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:23:12 +0100 Subject: [PATCH 02/10] remove --require-e2e --- .github/workflows/test.yml | 2 +- codemeta.json | 2 +- tests/test_entrypoint.sh | 11 ----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 840f53a..fd08283 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: -w /github/workspace \ --entrypoint bash \ codemeta2zenodo-test \ - tests/test_entrypoint.sh --require-e2e + tests/test_entrypoint.sh - name: Validate metadata files run: | diff --git a/codemeta.json b/codemeta.json index a4252bc..862e5f5 100644 --- a/codemeta.json +++ b/codemeta.json @@ -3,7 +3,7 @@ "@type": "SoftwareSourceCode", "name": "codemeta2zenodo", "description": "GitHub Action to convert codemeta.json files to .zenodo.json format using the eossr library for research software metadata management", - "version": "1.1.0", + "version": "1.2.0", "license": "https://spdx.org/licenses/MIT", "author": [ { diff --git a/tests/test_entrypoint.sh b/tests/test_entrypoint.sh index a6fa06c..32f770d 100755 --- a/tests/test_entrypoint.sh +++ b/tests/test_entrypoint.sh @@ -19,11 +19,6 @@ TESTS_RUN=0 TESTS_PASSED=0 TESTS_FAILED=0 TESTS_SKIPPED=0 -REQUIRE_E2E=false - -if [ "${1:-}" = "--require-e2e" ]; then - REQUIRE_E2E=true -fi # Test helper functions setup_test_dir() { @@ -187,12 +182,6 @@ test_real_entrypoint_e2e() { create_test_codemeta "codemeta.json" if ! command -v eossr-codemeta2zenodo >/dev/null 2>&1 || ! command -v eossr-zenodo-metadata-validator >/dev/null 2>&1; then - if [ "$REQUIRE_E2E" = "true" ]; then - echo "eossr commands are not available but --require-e2e was requested" - cleanup_test_dir - test_failed - return 1 - fi echo "Skipping real E2E test because eossr commands are not available in this environment" cleanup_test_dir test_skipped From 03ff5b57ecf652cdb9aa24389b624fe87813c6f1 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:25:08 +0100 Subject: [PATCH 03/10] force action --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd08283..9e35c62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: [main] + branches: ["**"] pull_request: - branches: [main] + types: [opened, synchronize, reopened, ready_for_review] workflow_dispatch: jobs: From b75df460d3bce4f705465a20535fd3a86d06a379 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:26:36 +0100 Subject: [PATCH 04/10] revert to main --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e35c62..fd08283 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: ["**"] + branches: [main] pull_request: - types: [opened, synchronize, reopened, ready_for_review] + branches: [main] workflow_dispatch: jobs: From fa38feb706bf42b9f5adc193f08dd96f31ad3e01 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:30:00 +0100 Subject: [PATCH 05/10] update date in codemeta --- codemeta.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codemeta.json b/codemeta.json index 862e5f5..11a36cd 100644 --- a/codemeta.json +++ b/codemeta.json @@ -44,8 +44,8 @@ "issueTracker": "https://github.com/escape2020/codemeta2zenodo/issues", "readme": "https://github.com/escape2020/codemeta2zenodo/blob/main/README.md", "dateCreated": "2026-02-23", - "dateModified": "2026-02-23", - "datePublished": "2026-02-23", + "dateModified": "2026-03-11", + "datePublished": "2026-03-11", "keywords": [ "codemeta", "zenodo", From 8e39f49e61b3ce1e9882d84debb56467fa492975 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:36:02 +0100 Subject: [PATCH 06/10] test with existing codemeta.json file --- codemeta.json | 1 + tests/fixtures/README.md | 12 -------- tests/fixtures/minimal_codemeta.json | 43 ---------------------------- tests/test_entrypoint.sh | 15 ++++++++-- 4 files changed, 14 insertions(+), 57 deletions(-) delete mode 100644 tests/fixtures/README.md delete mode 100644 tests/fixtures/minimal_codemeta.json diff --git a/codemeta.json b/codemeta.json index 11a36cd..906c965 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,6 +4,7 @@ "name": "codemeta2zenodo", "description": "GitHub Action to convert codemeta.json files to .zenodo.json format using the eossr library for research software metadata management", "version": "1.2.0", + "softwareVersion": "1.2.0", "license": "https://spdx.org/licenses/MIT", "author": [ { diff --git a/tests/fixtures/README.md b/tests/fixtures/README.md deleted file mode 100644 index 6121623..0000000 --- a/tests/fixtures/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Test Fixtures - -This directory contains test fixtures used for validating the codemeta2zenodo action. - -## Files - -- `minimal_codemeta.json`: A minimal but valid CodeMeta file with essential metadata -- Add more test fixtures as needed for different test scenarios - -## Usage - -These fixtures are used by the test suite in `test_entrypoint.sh` to verify that the action correctly processes various CodeMeta formats. diff --git a/tests/fixtures/minimal_codemeta.json b/tests/fixtures/minimal_codemeta.json deleted file mode 100644 index 73421a4..0000000 --- a/tests/fixtures/minimal_codemeta.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "@context": "https://doi.org/10.5063/schema/codemeta-2.0", - "@type": "SoftwareSourceCode", - "name": "example-research-software", - "description": "An example research software for testing metadata conversion", - "version": "1.0.0", - "license": "https://spdx.org/licenses/MIT", - "author": [ - { - "@type": "Person", - "givenName": "Jane", - "familyName": "Researcher", - "email": "jane.researcher@university.edu", - "@id": "https://orcid.org/0000-0001-2345-6789" - } - ], - "contributor": [ - { - "@type": "Person", - "givenName": "John", - "familyName": "Developer", - "email": "john.dev@university.edu" - } - ], - "programmingLanguage": [ - { - "@type": "ComputerLanguage", - "name": "Python", - "version": "3.9", - "url": "https://www.python.org/" - } - ], - "codeRepository": "https://github.com/example/research-software", - "dateCreated": "2025-01-15", - "dateModified": "2026-02-23", - "keywords": [ - "astronomy", - "data-analysis", - "research-software" - ], - "applicationCategory": "Science", - "funding": "European Research Council Grant No. 123456" -} diff --git a/tests/test_entrypoint.sh b/tests/test_entrypoint.sh index 32f770d..2cb5b98 100755 --- a/tests/test_entrypoint.sh +++ b/tests/test_entrypoint.sh @@ -87,13 +87,23 @@ create_test_codemeta() { "@type": "SoftwareSourceCode", "name": "test-software", "description": "A test software project", - "version": "1.0.0", + "softwareVersion": "1.0.0", + "license": "https://spdx.org/licenses/MIT", + "datePublished": "2026-03-11", + "readme": "https://github.com/example/test-software/blob/main/README.md", "author": [ { "@type": "Person", "givenName": "Test", "familyName": "User" } + ], + "maintainer": [ + { + "@type": "Person", + "givenName": "Test", + "familyName": "User" + } ] } EOF @@ -179,7 +189,8 @@ test_real_entrypoint_e2e() { run_test "Test 5: Real entrypoint end-to-end" TEST_DIR=$(setup_test_dir) - create_test_codemeta "codemeta.json" + # Use the project's real codemeta.json as the valid test fixture + cp "$PROJECT_ROOT/codemeta.json" "$TEST_DIR/codemeta.json" if ! command -v eossr-codemeta2zenodo >/dev/null 2>&1 || ! command -v eossr-zenodo-metadata-validator >/dev/null 2>&1; then echo "Skipping real E2E test because eossr commands are not available in this environment" From 048d1175eca8dd85c3d13cff3d6ea210d1974af9 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:36:28 +0100 Subject: [PATCH 07/10] forgot to add test.yml --- .github/workflows/test.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd08283..5e3b84e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,24 +73,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Create test codemeta.json - run: | - cat > codemeta.json <<'EOF' - { - "@context": "https://doi.org/10.5063/schema/codemeta-2.0", - "@type": "SoftwareSourceCode", - "name": "test-software", - "description": "A test software project", - "version": "1.0.0", - "author": [{ - "@type": "Person", - "givenName": "Test", - "familyName": "User" - }] - } - EOF - - - name: Test action (should succeed) + - name: Test action with project codemeta.json (should succeed) uses: ./ with: codemeta_file: "codemeta.json" From fb27403946ce60a91a0526410dc7fd410da275af Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:37:42 +0100 Subject: [PATCH 08/10] fix codemeta.json affiliations --- codemeta.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codemeta.json b/codemeta.json index 906c965..bcff0cc 100644 --- a/codemeta.json +++ b/codemeta.json @@ -13,7 +13,10 @@ "familyName": "Vuillaume", "email": "thomas.vuillaume@lapp.in2p3.fr", "@id": "https://orcid.org/0000-0002-5686-2078", - "affiliation": "LAPP, Université Savoie Mont Blanc, CNRS/IN2P3, Annecy, France" + "affiliation": { + "@type": "Organization", + "name": "LAPP, Université Savoie Mont Blanc, CNRS/IN2P3, Annecy, France" + } } ], "contributor": [], @@ -24,7 +27,10 @@ "familyName": "Vuillaume", "email": "thomas.vuillaume@lapp.in2p3.fr", "@id": "https://orcid.org/0000-0002-5686-2078", - "affiliation": "LAPP, Université Savoie Mont Blanc, CNRS/IN2P3, Annecy, France" + "affiliation": { + "@type": "Organization", + "name": "LAPP, Université Savoie Mont Blanc, CNRS/IN2P3, Annecy, France" + } } ], "programmingLanguage": [ From e09e76ab4bb5ea1df801f9e864f5fa277773eac4 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:40:24 +0100 Subject: [PATCH 09/10] fix codemeta funding --- .github/workflows/example.yml | 2 +- codemeta.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index b94832a..e60cc96 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v6 - name: Convert CodeMeta to Zenodo - uses: escape2020/codemeta2zenodo@v1 + uses: escape2020/codemeta2zenodo@v1.1.0 with: codemeta_file: "codemeta.json" overwrite: true diff --git a/codemeta.json b/codemeta.json index bcff0cc..c7eb2f2 100644 --- a/codemeta.json +++ b/codemeta.json @@ -113,5 +113,5 @@ "url": "https://doi.org/10.5063/schema/codemeta-2.0" } ], - "funding": "ESCAPE - The European Science Cluster of Astronomy & Particle Physics ESFRI Research Infrastructures" + "funding": "https://doi.org/10.3030/824064" } From 0f9b072cda36a930f3cc29508207c88670e8e9d9 Mon Sep 17 00:00:00 2001 From: Thomas Vuillaume Date: Wed, 11 Mar 2026 15:41:51 +0100 Subject: [PATCH 10/10] update to v1.2.0 --- .github/workflows/example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index e60cc96..af1ee4e 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v6 - name: Convert CodeMeta to Zenodo - uses: escape2020/codemeta2zenodo@v1.1.0 + uses: escape2020/codemeta2zenodo@v1.2.0 with: codemeta_file: "codemeta.json" overwrite: true