Close the file handler if the file is corrupt. #84
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: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
workflow_dispatch: # allows you to trigger manually | |
jobs: | |
detect-ci-trigger: | |
name: detect ci trigger | |
runs-on: ubuntu-latest | |
if: | | |
github.repository == 'fujiisoup/sif_parser' | |
&& (github.event_name == 'push' || github.event_name == 'pull_request') | |
outputs: | |
triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
test: | |
name: Set up python | |
runs-on: ubuntu-latest | |
needs: detect-ci-trigger | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
# Bookend python versions | |
python-version: ["3.8", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags. | |
- name: Set environment variables | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
echo "CONDA_ENV_FILE=ci/requirements/py${{ matrix.python-version }}.yml" >> $GITHUB_ENV | |
- name: Setup miniconda and install sif-parser | |
run: | | |
conda env create -n test_env --file $CONDA_ENV_FILE; | |
source /usr/share/miniconda/etc/profile.d/conda.sh; | |
conda activate test_env; | |
conda list; | |
pip install --no-deps -e .; | |
python -m pip install --no-deps -e . | |
- name: Import sif_parser | |
run: | | |
source /usr/share/miniconda/etc/profile.d/conda.sh; | |
conda activate test_env; | |
python -c "import sif_parser" | |
- name: Run tests | |
run: | | |
source /usr/share/miniconda/etc/profile.d/conda.sh; | |
conda activate test_env; | |
python -m pytest | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test results for ${{ runner.os }}-${{ matrix.python-version }} | |
path: pytest.xml |