test.yml: test on windows and macos (#290)

This commit is contained in:
Ali Parlakçı
2021-05-06 13:04:41 +03:00
committed by GitHub
parent 283ad164e5
commit 4ab1d6d6e0
3 changed files with 18 additions and 12 deletions

View File

@@ -8,15 +8,17 @@ on:
jobs: jobs:
test: test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9] python-version: [3.9]
ext: [.sh]
include:
- os: windows-latest
python-version: 3.9
ext: .ps1
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
@@ -26,19 +28,19 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip flake8 pytest pytest-cov python -m pip install --upgrade pip flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -r requirements.txt
- name: Setup test configuration - name: Make configuration for tests
env:
REDDIT_TOKEN: ${{ secrets.REDDIT_TEST_TOKEN }}
run: | run: |
cp bdfr/default_config.cfg ./test_config.cfg ./devscripts/configure${{ matrix.ext }}
echo -e "\nuser_token = ${{ secrets.REDDIT_TEST_TOKEN }}" >> ./test_config.cfg
- name: Lint w/ flake8 - name: Lint with flake8
run: | run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Test w/ PyTest - name: Test with pytest
run: | run: |
pytest -m 'not slow' --verbose --cov=./bdfr/ --cov-report term:skip-covered --cov-report html pytest -m 'not slow' --verbose --cov=./bdfr/ --cov-report term:skip-covered --cov-report html

2
devscripts/configure.ps1 Normal file
View File

@@ -0,0 +1,2 @@
copy .\\bdfr\\default_config.cfg .\\test_config.cfg
echo "`nuser_token = $env:REDDIT_TOKEN" >> ./test_config.cfg

2
devscripts/configure.sh Executable file
View File

@@ -0,0 +1,2 @@
cp ./bdfr/default_config.cfg ./test_config.cfg
echo -e "\nuser_token = $REDDIT_TOKEN" >> ./test_config.cfg