adds tests for new functionality #311
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# Optionally debug via SSH | |
# Ref: https://fleetdm.com/engineering/tips-for-github-actions-usability | |
# | |
# To use this step uncomment and place anywhere in the build steps. The build will pause on this step and | |
# output a ssh address associated with the Github action worker. Helpful for debugging build steps and | |
# and intermediary files/artifacts. | |
# Example: | |
# Web shell: https://tmate.io/t/q8FU3U9SvmMVxAhMHRyExNhr8 | |
# SSH: ssh [email protected] | |
# | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
name: DRS Downloader | |
on: | |
push: | |
branches: [ "main", "feature/**" ] | |
tags: | |
- '**' | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
pip install -e . | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 tests/ drs_downloader/ --count --statistics | |
- name: Unit tests (No server dependencies) with pytest | |
run: pytest tests/unit --cov=drs_downloader --cov-report term-missing | |
# - name: Unit and Integration tests with pytest | |
# run: pytest tests/unit tests/integration --cov=drs_downloader --cov-report term-missing | |
build: | |
needs: test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["macos-latest", "ubuntu-latest", "windows-latest"] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
shell: bash | |
run: | | |
pip install -r requirements.txt -r requirements-dev.txt | |
pyinstaller drs_downloader/cli.py --onefile --name drs_downloader | |
- name: Prepare artifact for release (macOS and Ubuntu) | |
if: runner.os != 'Windows' | |
run: mv ./dist/drs_downloader drs-downloader-${{ runner.os }} | |
- name: Prepare artifact for release (Windows) | |
if: runner.os == 'Windows' | |
shell: bash | |
run: | | |
python -m venv venv | |
venv/Scripts/activate.bat | |
- name: Install dependencies | |
shell: bash | |
run: | | |
pip install -r requirements.txt -r requirements-dev.txt | |
pyinstaller drs_downloader/cli.py --onefile --name drs-downloader-${{ runner.os }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: drs-downloader-${{ runner.os }} | |
path: dist/* | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Create checksums | |
shell: bash | |
run: | | |
mkdir release | |
mv drs-downloader-*/* release | |
cd release | |
sha256sum * > checksums.txt | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
release/* |