repo2docker/.github/workflows/test.yml

124 wiersze
3.7 KiB
YAML

# Useful GitHub Actions docs:
#
# - https://help.github.com/en/actions
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
name: Continuous Integration
on:
push:
pull_request:
schedule:
# Weekly test so we know if tests break for external reasons
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
- cron: '36 10 * * 0'
# Global environment variables
env:
GIT_COMMITTER_EMAIL: ci-user@github.local
GIT_COMMITTER_NAME: CI User
GIT_AUTHOR_EMAIL: ci-user@github.local
GIT_AUTHOR_NAME: CI User
jobs:
# Job to run linter / autoformat
lint:
runs-on: ubuntu-18.04
steps:
# Action Repo: https://github.com/actions/checkout
- name: "Checkout repo"
uses: actions/checkout@v2
with:
fetch-depth: 0
# Action Repo: https://github.com/actions/setup-python
- name: "Setup Python"
uses: actions/setup-python@v2
with:
python-version: "3.8"
# Action Repo: https://github.com/actions/cache
- name: "Cache pip dependencies"
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: "Install dependencies"
run: |
pip install --upgrade setuptools pip
pip install --upgrade -r dev-requirements.txt
pip freeze
- name: "Run linter"
run: |
pre-commit run --all-files
test:
# Previous job must have successfully completed for this job to execute
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
needs: lint
runs-on: ubuntu-18.04
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
strategy:
fail-fast: false # Do not cancel all jobs if one fails
matrix:
python_version: ["3.8"]
repo_type:
- base
- conda
- dockerfile
- external
- julia
- nix
- pipfile
- r
- unit
- venv
include:
- python_version: "3.6"
repo_type: venv
steps:
- name: "Checkout repo"
uses: actions/checkout@v2
- name: "Setup Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
# Action Repo: https://github.com/actions/cache
- name: "Cache pip dependencies"
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: "Install"
run: |
pip install --upgrade setuptools pip wheel
pip install --upgrade -r dev-requirements.txt
python setup.py bdist_wheel
pip install dist/*.whl
pip freeze
# hg-evolve pinned to 9.2 because hg-evolve dropped support for
# hg 4.5, installed with apt in Ubuntu 18.04
$(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve==9.2 --user
- name: "Run tests"
run: |
cd tests
pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }}
# Action Repo: https://github.com/codecov/codecov-action
- uses: codecov/codecov-action@v1
with:
directory: ./tests