diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index b94832a..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 + uses: escape2020/codemeta2zenodo@v1.2.0 with: codemeta_file: "codemeta.json" overwrite: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 920c12d..5e3b84e 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 + - name: Validate metadata files run: | echo "Validating metadata files..." @@ -63,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" diff --git a/codemeta.json b/codemeta.json index a4252bc..c7eb2f2 100644 --- a/codemeta.json +++ b/codemeta.json @@ -3,7 +3,8 @@ "@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", + "softwareVersion": "1.2.0", "license": "https://spdx.org/licenses/MIT", "author": [ { @@ -12,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": [], @@ -23,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": [ @@ -44,8 +51,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", @@ -106,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" } 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/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 8da5c82..2cb5b98 100755 --- a/tests/test_entrypoint.sh +++ b/tests/test_entrypoint.sh @@ -18,6 +18,7 @@ NC='\033[0m' # No Color TESTS_RUN=0 TESTS_PASSED=0 TESTS_FAILED=0 +TESTS_SKIPPED=0 # Test helper functions setup_test_dir() { @@ -72,6 +73,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} @@ -81,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 @@ -168,6 +184,39 @@ 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) + + # 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" + 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