This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
[pre-commit.ci] pre-commit suggestions #79
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 testing | |
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: | |
# Trigger the workflow on push or pull request, but only for the master branch | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macOS-11, windows-2019] | |
python-version: [3.8] | |
# Timeout: https://stackoverflow.com/a/59076067/4521646 | |
timeout-minutes: 35 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646 | |
- name: Setup macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030 | |
# Note: This uses an internal pip API and may not always work | |
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-py${{ matrix.python-version }}- | |
- name: Install dependencies | |
run: | | |
python --version | |
pip --version | |
pip install --requirement requirements.txt --upgrade --quiet --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip install --requirement tests/requirements.txt --quiet | |
pip list | |
shell: bash | |
- name: Tests | |
env: | |
BOT_TOKEN: ${{secrets.BOT_TOKEN}} | |
SLACK_TOKEN: ${{secrets.SLACK_TOKEN}} | |
SIGNING_SECRET: ${{secrets.SIGNING_SECRET}} | |
SLACK_CLIENT_ID: ${{secrets.SLACK_CLIENT_ID}} | |
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} | |
run: | | |
coverage run --source slack_command_bot -m pytest slack_command_bot tests -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
- name: Statistics | |
if: success() | |
run: | | |
coverage report |