This repository has been archived by the owner on Aug 27, 2024. It is now read-only.
EthicML CI #1715
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: EthicML CI | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '**/*.md' | |
- .github/dependabot.yml | |
- .github/release.yml | |
- .github/workflows/docs.yml | |
- .github/workflows/dummy_ci.yml | |
- .github/workflows/dependabot_auto.yml | |
- .github/workflows/labeler.yml | |
- .gitignore | |
- CODEOWNERS | |
- LICENSE | |
- make_release.sh | |
- CITATION.cff | |
merge_group: | |
jobs: | |
lint_with_ruff: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install ruff | |
run: | | |
poetry env use 3.10 | |
poetry install --only lint --no-interaction --no-root | |
- name: Lint with ruff | |
run: | | |
poetry run ruff check --output-format=github ethicml | |
- name: Lint with ruff | |
run: | | |
poetry run ruff check --output-format=github tests | |
format_with_black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install ruff | |
run: | | |
poetry env use 3.10 | |
poetry install --only lint --no-interaction --no-root | |
- name: Format with ruff | |
run: | | |
poetry run ruff format --diff . | |
check_with_pydoclint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' # might as well use 3.11 as it's faster | |
- name: Install pydoclint | |
run: | | |
poetry env use 3.11 | |
poetry install --only doclint --no-interaction --no-root | |
- name: Check with pydoclint | |
run: | | |
poetry run pydoclint ethicml | |
test_minimal_dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
poetry env use 3.10 | |
poetry install --no-interaction --no-root --without dev,test,typecheck,lint,doclint | |
- name: Test import | |
run: | | |
poetry run python -c "import ethicml" | |
test_build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
poetry env use 3.10 | |
poetry install --no-interaction --no-root --all-extras --with ci,torchcpu,docs --without lint,doclint | |
- name: Test import | |
run: | | |
poetry run python -c "import ethicml" | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc | |
- name: Build with sphinx | |
run: | | |
poetry run sphinx-build -W -b html ./docs ./docs/_build | |
test_with_pytest: | |
needs: [lint_with_ruff, format_with_black, check_with_pydoclint, test_minimal_dependencies, test_build_docs] | |
runs-on: ubuntu-latest | |
steps: | |
#---------------------------------------------- | |
# --- check-out repo and set-up python --- | |
#---------------------------------------------- | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
if: ${{ github.event_name == 'merge_group' }} | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
if: ${{ github.event_name == 'merge_group' }} | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
#---------------------------------------------- | |
# --------- install dependencies -------- | |
#---------------------------------------------- | |
- name: Install dependencies | |
if: ${{ github.event_name == 'merge_group' }} | |
run: | | |
poetry env use 3.10 | |
poetry install --no-interaction --no-root --all-extras --with ci,torchcpu --without lint,doclint | |
#---------------------------------------------- | |
# ----- Run MyPy ----- | |
#---------------------------------------------- | |
- name: Type check with mypy | |
if: ${{ github.event_name == 'merge_group' }} | |
run: | | |
poetry run mypy ethicml | |
#---------------------------------------------- | |
# ----- Run MyPy on tests ----- | |
#---------------------------------------------- | |
- name: Type check tests with mypy | |
if: ${{ github.event_name == 'merge_group' }} | |
run: | | |
poetry run mypy tests | |
#---------------------------------------------- | |
# ----- Run Tests ----- | |
#---------------------------------------------- | |
- name: Test with pytest | |
if: ${{ github.event_name == 'merge_group' }} | |
run: | | |
poetry run python -m pytest -vv -n 2 --dist loadgroup --cov=ethicml --cov-fail-under=80 tests/ |