From 4ab1d6d6e03d4ba633d4151fa357490246f36ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Parlak=C3=A7=C4=B1?= Date: Thu, 6 May 2021 13:04:41 +0300 Subject: [PATCH] test.yml: test on windows and macos (#290) --- .github/workflows/test.yml | 26 ++++++++++++++------------ devscripts/configure.ps1 | 2 ++ devscripts/configure.sh | 2 ++ 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 devscripts/configure.ps1 create mode 100755 devscripts/configure.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf3bfbb..5aa8c61 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,15 +8,17 @@ on: jobs: test: - - runs-on: ubuntu-latest - + runs-on: ${{ matrix.os }} strategy: matrix: + os: [ubuntu-latest, macos-latest] python-version: [3.9] - + ext: [.sh] + include: + - os: windows-latest + python-version: 3.9 + ext: .ps1 steps: - - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 @@ -26,19 +28,19 @@ jobs: - name: Install dependencies run: | 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: | - cp bdfr/default_config.cfg ./test_config.cfg - echo -e "\nuser_token = ${{ secrets.REDDIT_TEST_TOKEN }}" >> ./test_config.cfg + ./devscripts/configure${{ matrix.ext }} - - name: Lint w/ flake8 + - name: Lint with flake8 run: | - # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - name: Test w/ PyTest + - name: Test with pytest run: | pytest -m 'not slow' --verbose --cov=./bdfr/ --cov-report term:skip-covered --cov-report html diff --git a/devscripts/configure.ps1 b/devscripts/configure.ps1 new file mode 100644 index 0000000..8ac0ce1 --- /dev/null +++ b/devscripts/configure.ps1 @@ -0,0 +1,2 @@ +copy .\\bdfr\\default_config.cfg .\\test_config.cfg +echo "`nuser_token = $env:REDDIT_TOKEN" >> ./test_config.cfg \ No newline at end of file diff --git a/devscripts/configure.sh b/devscripts/configure.sh new file mode 100755 index 0000000..48e7c3e --- /dev/null +++ b/devscripts/configure.sh @@ -0,0 +1,2 @@ +cp ./bdfr/default_config.cfg ./test_config.cfg +echo -e "\nuser_token = $REDDIT_TOKEN" >> ./test_config.cfg \ No newline at end of file