test: add condition when changelog is missing #44
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade -r requirements.txt | |
python -m pip install --upgrade -r requirements-dev.txt | |
- name: Test with pytest | |
id: test | |
env: | |
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
python -m pytest \ | |
-rxXs \ | |
--tb=native \ | |
--verbose \ | |
--cov=action \ | |
tests | |
- name: Upload coverage | |
# any except cancelled or skipped | |
if: >- | |
always() && | |
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') | |
uses: codecov/codecov-action@v3 | |
action: | |
strategy: | |
fail-fast: false | |
matrix: | |
set: | |
- '0' | |
- '1' | |
- '2' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Action | |
id: action | |
uses: ./ | |
with: | |
changelog_path: ./tests/data/set${{ matrix.set }}/CHANGELOG.md | |
fail_on_events_api_error: false | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Print action outputs | |
shell: bash | |
run: | | |
echo "changelog_exists: ${{ steps.action.outputs.changelog_exists }}" | |
echo "changelog_changes: ${{ steps.action.outputs.changelog_changes }}" | |
echo "changelog_date: ${{ steps.action.outputs.changelog_date }}" | |
echo "changelog_url: ${{ steps.action.outputs.changelog_url }}" | |
echo "changelog_version: ${{ steps.action.outputs.changelog_version }}" | |
echo "changelog_release_exists: ${{ steps.action.outputs.changelog_release_exists }}" | |
echo "publish_stable_release: ${{ steps.action.outputs.publish_stable_release }}" | |
echo "release_version: ${{ steps.action.outputs.release_version }}" | |
echo "release_build: ${{ steps.action.outputs.release_build }}" | |
echo "release_tag: ${{ steps.action.outputs.release_tag }}" | |
- name: Verify changelog_exists | |
shell: bash | |
run: | | |
if [[ "${{ steps.action.outputs.changelog_exists }}" != "True" ]]; then | |
if [[ "${{ matrix.set }}" != "0" ]]; then | |
echo "changelog_exists is not true" | |
exit 1 | |
fi | |
fi | |
- name: Verify changelog_changes | |
shell: bash | |
run: | | |
expected_changes=$(cat ./tests/data/set${{ matrix.set }}/changes.txt) | |
if [[ "${{ steps.action.outputs.changelog_changes }}" != "${expected_changes}" ]]; then | |
echo "changelog_changes does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_date | |
shell: bash | |
run: | | |
expected_date=$(cat ./tests/data/set${{ matrix.set }}/date.txt) | |
if [[ "${{ steps.action.outputs.changelog_date }}" != "${expected_date}" ]]; then | |
echo "changelog_date does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_url | |
shell: bash | |
run: | | |
expected_url=$(cat ./tests/data/set${{ matrix.set }}/url.txt) | |
if [[ "${{ steps.action.outputs.changelog_url }}" != "${expected_url}" ]]; then | |
echo "changelog_url does not match expected" | |
exit 1 | |
fi | |
- name: Verify changelog_version | |
shell: bash | |
run: | | |
expected_version=$(cat ./tests/data/set${{ matrix.set }}/version.txt) | |
if [[ "${{ steps.action.outputs.changelog_version }}" != "${expected_version}" ]]; then | |
echo "changelog_version does not match expected" | |
exit 1 | |
fi |