Skip to content

Commit

Permalink
Fix test, CHANGELOG and improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido committed Jun 13, 2024
1 parent d7ad424 commit d59e421
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
39 changes: 34 additions & 5 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Poetry cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.POETRY_CACHE_DIR }}
key: ${{ runner.os }}-poetry${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -54,8 +54,7 @@ jobs:
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude onfido
- name: Test with pytest
if: ${{ matrix.python-version == '3.11' &&
github.repository_owner == 'onfido' &&
github.actor != 'dependabot[bot]' }}
github.repository_owner == 'onfido' }}
run: |
poetry run pytest --show-capture=no
env:
Expand All @@ -72,8 +71,10 @@ jobs:
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
Expand All @@ -87,3 +88,31 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Update CHANGELOG.md
run: |
TMP_FILE=$(mktemp)
RELEASE_VERSION=$(jq -r '.release' .release.json)
RELEASE_DATE=`date +'%dth %B %Y' | sed -E 's/^0//;s/^([2,3]?)1th/\11st/;s/^([2]?)2th/\12nd/;s/^([2]?)3th/\13rd/'`
SPEC_COMMIT_SHA=$(jq -r '.source.short_sha' .release.json)
SPEC_COMMIT_URL=$(jq -r '.source.repo_url + "/commit/" + .source.long_sha' .release.json)
SPEC_RELEASE_VERSION=$(jq -r '.source.version' .release.json)
SPEC_RELEASE_URL=$(jq -r '.source.repo_url + "/releases/tag/" + .source.version' .release.json)
echo -e "# Changelog\n\n## $RELEASE_VERSION $RELEASE_DATE\n\n" >| $TMP_FILE
echo -en "${{ github.event.release.body }}\nBased on Onfido OpenAPI spec " >> $TMP_FILE
if [ -z $SPEC_RELEASE_VERSION ]; then
echo "up to commit [$SPEC_COMMIT_SHA](${SPEC_COMMIT_URL})." >> $TMP_FILE
else
echo "version [$SPEC_RELEASE_VERSION](${SPEC_RELEASE_URL})." >> $TMP_FILE
fi
grep -v "^# Changelog" CHANGELOG.md >> $TMP_FILE
mv $TMP_FILE CHANGELOG.md
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git commit -m "Update CHANGELOG.md after library release" CHANGELOG.md
git push
5 changes: 0 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Changelog

## v3.0.0 14th Jun 2024

- Make library auto-generated and based on [Onfido OpenAPI spec](https://github.com/onfido/onfido-openapi-spec)
- Refresh library up to commit: [62dc554](https://github.com/onfido/onfido-openapi-spec/commit/62dc5541a4a51e8de313fc99fb3dec496033a23e)

## v2.10.0 24th November 2023

- Added core methods for [WorkflowRuns](https://documentation.onfido.com/#workflow-runs)
Expand Down
1 change: 1 addition & 0 deletions tests/test_report_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ def test_schema_of_facial_similarity_report_id_valid(
onfido_api.find_report, [facial_similarity_report_id], ReportStatus.COMPLETE
)
assert isinstance(facial_similarity_report, FacialSimilarityPhotoReport)
assert facial_similarity_report.properties.score is None

0 comments on commit d59e421

Please sign in to comment.