diff --git a/.github/actions/setup-uv/action.yml b/.github/actions/setup-uv/action.yml index a2ee5ea..74a796a 100644 --- a/.github/actions/setup-uv/action.yml +++ b/.github/actions/setup-uv/action.yml @@ -4,7 +4,8 @@ description: Install Python, uv, and sync dependencies with caching inputs: dependency-group: description: 'Dependency group to sync (e.g., dev, test, docs)' - required: true + required: false + default: '' runs: using: composite @@ -30,4 +31,9 @@ runs: - name: Sync dependencies shell: bash - run: uv sync --locked --extra ${{ inputs.dependency-group }} # extras are defined in [project.optional-dependencies] + run: | + cmd="uv sync --locked" + if [ -n "${{ inputs.dependency-group }}" ]; then + cmd="$cmd --extra ${{ inputs.dependency-group }}" + fi + eval "$cmd" # extras are defined in [project.optional-dependencies] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8398a6e..7f64d2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,10 +97,6 @@ jobs: run: uv run genbadge coverage -i coverage.xml -o coverage.svg continue-on-error: true - - name: Run small analysis without publishing - run: uv run sw-metadata-bot run-analysis --config-file assets/example_list_repo.json - - - name: Commit coverage badge if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: | @@ -111,9 +107,20 @@ jobs: git push continue-on-error: true + test-small-analysis: + name: Minimal integration test (small analysis) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Setup uv environment + uses: ./.github/actions/setup-uv + + - name: Run small analysis without publishing + run: uv run sw-metadata-bot run-analysis --config-file assets/example_list_repo.json + test-gitlab-integration: name: Test (GitLab integration) - if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest env: GITLAB_API_TOKEN: ${{ secrets.GITLAB_API_TOKEN }} @@ -132,11 +139,9 @@ jobs: exit 0 - name: Verify GitLab token before integration tests - if: ${{ env.GITLAB_API_TOKEN != '' }} run: uv run sw-metadata-bot verify-tokens --gitlab - name: Run GitLab integration tests - if: ${{ env.GITLAB_API_TOKEN != '' }} run: uv run pytest --run-integration-gitlab -m "integration_gitlab" tests/test_gitlab_integration.py @@ -206,7 +211,7 @@ jobs: publish-pypi: name: Publish to PyPI if: github.event_name == 'release' - needs: [lint, test] + needs: [lint, test, test-zenodo-connection, test-gitlab-integration, test-small-analysis] runs-on: ubuntu-latest permissions: id-token: write @@ -228,7 +233,7 @@ jobs: publish-zenodo: # name: Publish to Zenodo if: github.event_name == 'release' - needs: [lint, test, test-zenodo-connection] + needs: [lint, test, test-zenodo-connection, test-gitlab-integration, test-small-analysis] runs-on: ubuntu-latest container: image: registry.gitlab.com/escape-ossr/eossr:v2.2.0 @@ -242,12 +247,12 @@ jobs: - name: Change publicationDate in .zenodo.json to current date (fix eossr) run: | TODAY=$(date +%Y-%m-%d) - sed -i "s/\"publicationDate\": \".*\"/\"publicationDate\": \"$TODAY\"/" .zenodo.json + sed -i "s/\"publication_date\": \".*\"/\"publication_date\": \"$TODAY\"/" .zenodo.json sed -i "s/\"dateModified\": \".*\"/\"dateModified\": \"$TODAY\"/" codemeta.json - name: Upload and Publish to Zenodo via eossr run: | eossr-upload-repository \ --token "${{ secrets.ZENODO_ACCESS_TOKEN }}" \ --input-dir . \ - --archive-name sw-metadata-bot-{{github.event.release.tag_name}}.zip \ + --archive-name "sw-metadata-bot-${{ github.event.release.tag_name }}.zip" \ --record_id "${{ secrets.ZENODO_DEPOSITION_ID }}"