54 lines
1.7 KiB
YAML
54 lines
1.7 KiB
YAML
name: Test Adabot
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
check-repo-owner:
|
|
# This job is so the entire workflow will end successfully and give some
|
|
# output to explain why it hasn't run on a non-Adafruit fork.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: repository
|
|
env:
|
|
OWNER_IS_ADAFRUIT: ${{ startswith(github.repository, 'adafruit/') }}
|
|
run: |
|
|
echo "This workflow will only run if Adafruit is the repository owner."
|
|
echo "Repository owner is Adafruit: $OWNER_IS_ADAFRUIT"
|
|
run-tests:
|
|
runs-on: ubuntu-latest
|
|
# Only run the build on Adafruit's repository. Forks won't have the secrets.
|
|
# Its necessary to do this here, since 'schedule' events cannot (currently)
|
|
# be limited (they run on all forks' default branches).
|
|
if: startswith(github.repository, 'adafruit/')
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379/tcp
|
|
options: --entrypoint redis-server
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: 3.9
|
|
- name: Versions
|
|
run: |
|
|
python3 --version
|
|
- uses: actions/checkout@v1
|
|
with:
|
|
submodules: true
|
|
- name: Install deps
|
|
run: |
|
|
pip install -r requirements.txt
|
|
- name: Run Tests
|
|
env:
|
|
ADABOT_EMAIL: ${{ secrets.ADABOT_EMAIL }}
|
|
ADABOT_GITHUB_USER: ${{ secrets.ADABOT_GITHUB_USER }}
|
|
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
|
|
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
|
|
run: |
|
|
python3 -u -m pytest
|