repo2docker/.github/workflows/test.yml

127 wiersze
3.5 KiB
YAML
Czysty Zwykły widok Historia

2022-10-08 11:28:21 +00:00
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2020-08-11 08:13:48 +00:00
#
2022-10-08 11:28:21 +00:00
name: Test
2020-08-11 08:13:48 +00:00
on:
pull_request:
2022-10-08 11:28:21 +00:00
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/test.yml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/test.yml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
tags:
- "**"
schedule:
2022-10-08 11:28:21 +00:00
# Run weekly test so we know if tests break for external reasons
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#scheduled-events
#
# At 10:36 on Sunday (https://crontab.guru)
- cron: '36 10 * * 0'
2022-10-08 11:28:21 +00:00
workflow_dispatch:
2020-08-11 08:13:48 +00:00
# Global environment variables
2020-08-11 12:34:37 +00:00
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
2020-08-11 08:13:48 +00:00
jobs:
pre-commit:
2022-10-08 12:22:45 +00:00
runs-on: ubuntu-22.04
2020-08-11 08:13:48 +00:00
steps:
2022-10-08 11:31:01 +00:00
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2020-08-11 08:13:48 +00:00
with:
python-version: "3.8"
# There will almost never be a cache hit on the cache key when this job is
# run, as it is the first of all jobs in this workflow. The subsequent
# jobs in this workflow can rely on this cache though.
- name: Save pip's install cache on job completion
2022-10-08 11:31:01 +00:00
uses: actions/cache@v3
2020-08-11 08:13:48 +00:00
with:
path: ~/.cache/pip
key: "${{ github.run_id }}"
2020-08-11 08:13:48 +00:00
- name: "Install dependencies"
run: |
pip install --upgrade setuptools pip
pip install --upgrade -r dev-requirements.txt
pip freeze
- run: pre-commit run --all-files
2020-08-11 08:13:48 +00:00
test:
needs: pre-commit
2022-10-08 12:22:45 +00:00
runs-on: ubuntu-${{ matrix.ubuntu_version }}"
2020-08-11 08:13:48 +00:00
strategy:
fail-fast: false # Do not cancel all jobs if one fails
matrix:
2022-10-08 12:22:45 +00:00
ubuntu_version: ["22.04"]
2020-08-11 08:13:48 +00:00
python_version: ["3.8"]
repo_type:
- base
- conda
- dockerfile
- external
- julia
- nix
- pipfile
- r
- unit
- venv
include:
2022-10-08 12:22:45 +00:00
# The actions/setup-python action with Python version 3.6 isn't
# possible to use with the ubuntu-22.04 runner, so we use ubuntu-20.04
# for this test where Python 3.6 remain available.
- ubuntu_version: "20.04"
python_version: "3.6"
2020-08-11 08:13:48 +00:00
repo_type: venv
steps:
2022-10-08 11:31:01 +00:00
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2020-08-11 08:13:48 +00:00
with:
2022-10-08 11:31:01 +00:00
python-version: "${{ matrix.python_version }}"
2020-08-11 08:13:48 +00:00
- name: Restore pip's install cache from previous job
2022-10-08 11:31:01 +00:00
uses: actions/cache@v3
2020-08-11 08:13:48 +00:00
with:
path: ~/.cache/pip
key: "${{ github.run_id }}"
2020-08-11 08:13:48 +00:00
- 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
2022-08-22 13:36:23 +00:00
# add for mercurial tests
pip install mercurial hg-evolve
2020-08-11 08:13:48 +00:00
pip freeze
- name: "Run tests"
run: |
2020-11-06 06:44:53 +00:00
cd tests
pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }}
2020-08-11 08:13:48 +00:00
- name: "Upload code coverage stats"
run: |
pip install codecov
pushd tests && codecov && cat
cat /home/runner/work/repo2docker/repo2docker/tests/coverage.xml