Skip to content

Update dependency torch to v2 #123

Update dependency torch to v2

Update dependency torch to v2 #123

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
env:
PYTHON_VERSION: 3.9
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: pre-commit/[email protected]
list:
runs-on: ubuntu-latest
name: Setup Matrix
outputs:
examples-matrix: ${{ steps.examples-matrix.outputs.examples }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Get experiments
id: examples-matrix
run: |
echo "::set-output name=examples::$(python .ci/list_examples.py)"
unittest:
strategy:
matrix:
python: [3.8, 3.9]
runs-on: ubuntu-latest
needs: [pre-commit]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: install
run: |
python -m pip install .[test]
- name: test
run: |
coverage run -m unittest discover -s tests/unit
coverage report -m --omit='tests/unit/*'
- if: ${{ matrix.python == '3.9' }}
name: Get Coverage for badge
run: |
coverage json
COVERAGE=$(LC_NUMERIC="en_US.UTF-8" printf "%.2f%%" $(cat coverage.json | jq .totals.percent_covered))
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
REF=${{ github.ref }}
echo "github.ref: $REF"
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo $BRANCH_NAME
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- if: ${{ matrix.python == '3.9' }}
name: Create the Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 9b54bd086e121233d2ad9a62d2136258
filename: frarch__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: codecov
unittest-cross-platform:
strategy:
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: [pre-commit]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install
run: |
python -m pip install -q .[test]
- name: test
run: |
coverage run -m unittest discover -s tests/unit
coverage report -m --omit='tests/unit/*'
functional:
runs-on: ubuntu-latest
needs: [list]
strategy:
matrix:
examples: ${{ fromJSON(needs.list.outputs.examples-matrix) }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up yq
uses: frenck/action-setup-yq@v1
- name: install
run: |
python -m pip install -q .[test]
- name: Run ${{ matrix.example }}
run: |
./.ci/runExample.sh ${{ matrix.examples }}
package-and-release:
runs-on: ubuntu-latest
needs: [unittest, functional]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: install
run: |
python -m pip install twine build
python -m build .
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}