fixes to make examples/qasper work #241
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
# Change this to invalidate existing cache. | |
CACHE_PREFIX: v0 | |
PYTHON_PATH: ./ | |
jobs: | |
checks: | |
name: python ${{ matrix.python }} - ${{ matrix.task.name }} | |
runs-on: [ubuntu-latest] | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [3.9] | |
task: | |
- name: Style | |
run: | | |
isort --check . | |
black --check . | |
- name: Lint | |
run: | | |
flake8 . | |
- name: Type check | |
run: | | |
mypy . | |
- name: Test | |
run: | | |
pytest -v --color=yes tests/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install prerequisites | |
run: | | |
pip install --upgrade pip setuptools wheel virtualenv | |
- name: Set build variables | |
shell: bash | |
run: | | |
# Get the exact Python version to use in the cache key. | |
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_ENV | |
echo "RUNNER_ARCH=$(uname -m)" >> $GITHUB_ENV | |
# Use week number in cache key so we can refresh the cache weekly. | |
echo "WEEK_NUMBER=$(date +%V)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
id: virtualenv-cache | |
with: | |
path: .venv | |
key: ${{ env.CACHE_PREFIX }}-${{ env.WEEK_NUMBER }}-${{ runner.os }}-${{ env.RUNNER_ARCH }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
${{ env.CACHE_PREFIX }}-${{ env.WEEK_NUMBER }}-${{ runner.os }}-${{ env.RUNNER_ARCH }}-${{ env.PYTHON_VERSION }}- | |
- name: Setup virtual environment (no cache hit) | |
if: steps.virtualenv-cache.outputs.cache-hit != 'true' | |
# we run pip install twice because otherwise we get stuck into | |
# backtracking for pytorch. if we got for the first install, we | |
# will automatically get the latest version of pytorch. | |
run: | | |
test -d .venv || virtualenv -p $(which python) --copies --reset-app-data .venv | |
. .venv/bin/activate | |
pip install . && rm -rf build && pip install -e .[all] | |
- name: Setup virtual environment (cache hit) | |
if: steps.virtualenv-cache.outputs.cache-hit == 'true' | |
run: | | |
. .venv/bin/activate | |
pip install --no-deps -e . | |
- name: Show environment info | |
run: | | |
. .venv/bin/activate | |
which python | |
python --version | |
pip freeze | |
- name: ${{ matrix.task.name }} | |
run: | | |
. .venv/bin/activate | |
${{ matrix.task.run }} | |
- name: Clean up | |
if: always() | |
run: | | |
. .venv/bin/activate | |
pip uninstall -y smashed |