Skip to content

Commit

Permalink
Skip Changelog test on push to main (#558)
Browse files Browse the repository at this point in the history
* enh: add chores workflow as example

* fix: rename tests to chores

* fix: fix license header test

* fix: refactor workflows

* fix: rebase regression_tests to main

* fix: skip changelog on pushes

* fix: better license check

* chore: update changelog
  • Loading branch information
jnsbck authored Dec 18, 2024
1 parent e955973 commit ac5026d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
40 changes: 29 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ jobs:
# Compare the first line
if [ "$file_header_1" != "$expected_header_1" ]; then
echo "❌ Incorrect first line in $file"
exit_code=1
echo "❌ Missing or incorrect license header in $file"
exit 1
fi
# Compare the second line
if [ "$file_header_2" != "$expected_header_2" ]; then
echo "❌ Incorrect second line in $file"
exit_code=1
echo "❌ Missing or incorrect license header in $file"
exit 1
fi
done < <(find jaxley tests -name "*.py" -type f)
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Ensure that the changelog was updated
id: changelog
if: always() # Run this step even if the previous one fails
if: github.event_name == 'pull_request' # Only run on pull requests
run: |
# Ensure the main branch is up-to-date
git fetch origin main
Expand All @@ -88,14 +88,32 @@ jobs:
fi
- name: Final check
if: always() # Run this step even if the previous one fails
run: |
if [[ "${{ steps.black.outcome }}" != "success" ||
"${{ steps.isort.outcome }}" != "success" ||
"${{ steps.license.outcome }}" != "success" ||
"${{ steps.changelog.outcome }}" != "success" ]]; then
echo "❌ Some checks failed!"
failed_checks=()
if [[ "${{ steps.black.outcome }}" != "success" ]]; then
failed_checks+=("black formatting")
fi
if [[ "${{ steps.isort.outcome }}" != "success" ]]; then
failed_checks+=("isort imports")
fi
if [[ "${{ steps.license.outcome }}" != "success" ]]; then
failed_checks+=("license headers")
fi
if [[ "${{ steps.changelog.outcome }}" != "success" && "${{ github.event_name }}" == "pull_request" ]]; then
failed_checks+=("changelog update")
fi
if (( ${#failed_checks[@]} > 0 )); then
echo "❌ The following checks failed:"
printf '%s\n' "${failed_checks[@]}"
exit 1
fi
echo "✅ All checks passed"
pytest:
Expand All @@ -120,4 +138,4 @@ jobs:
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest tests/ -m "not regression" --cov=jaxley --cov-report=xml
pytest tests/ -m "not regression" --cov=jaxley --cov-report=xml
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ net.vis()

- Allow parameter sharing for groups of different sizes, i.e. due to inhomogenous numbers of compartments or for synapses with the same (pre-)synaptic parameters but different numbers of post-synaptic partners. (#514, @jnsbck)

- changelog added to CI
- changelog added to CI (#537, #558, @jnsbck)

# 0.5.0

Expand Down

0 comments on commit ac5026d

Please sign in to comment.