Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 11 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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"
Expand Down
19 changes: 13 additions & 6 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -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": [],
Expand All @@ -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": [
Expand All @@ -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",
Expand Down Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions tests/fixtures/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions tests/fixtures/minimal_codemeta.json

This file was deleted.

53 changes: 52 additions & 1 deletion tests/test_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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}
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -178,6 +227,7 @@ test_script_syntax
test_script_executable
test_missing_input
test_fixture_validity
test_real_entrypoint_e2e

# Summary
echo ""
Expand All @@ -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
Expand Down
Loading