enhance tests #169
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: test_build | |
on: | |
push: | |
paths: | |
- "src/**.py" | |
- "tests/**.py" | |
- "setup.cfg" | |
- "MANIFEST.in" | |
- "pyproject.toml" | |
- "requirements.txt" | |
- ".github/workflows/test_build.yaml" | |
- ".github/workflows/tag_and_release.yaml" | |
pull_request: | |
paths: | |
- "src/**.py" | |
- "tests/**.py" | |
- "setup.cfg" | |
- "MANIFEST.in" | |
- "pyproject.toml" | |
- "requirements.txt" | |
- ".github/workflows/test_build.yaml" | |
- ".github/workflows/tag_and_release.yaml" | |
jobs: | |
test_build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13] | |
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
python-version: ["3.7", "3"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install build tools | |
run: pip install setuptools wheel build pyinstaller | |
- name: Install requirements | |
shell: bash | |
run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Read VERSION file | |
id: getversion | |
shell: bash | |
run: echo "$(python ./setup.py --version)" | |
- name: Run Tests - Source | |
run: python tests/tests.py | |
- name: Run build | |
run: python3 -m build | |
- name: Get Wheel File Path | |
id: getwheelfile | |
shell: bash | |
run: echo "::set-output name=wheelfile::$(find "dist" -type f -name "*.whl")" | |
- name: Test pip install of wheel | |
shell: bash | |
run: pip install $(find "dist" -type f -name "*.whl") | |
- name: Test python import besapi | |
shell: bash | |
run: python -c "import besapi" | |
- name: Test python import bescli | |
shell: bash | |
run: python -c "import bescli" | |
- name: Test python bescli | |
shell: bash | |
run: python -m bescli ls logout clear error_count version exit | |
- name: Run Tests - Pip | |
run: python tests/tests.py --test_pip | |
- name: Test pyinstaller build | |
run: pyinstaller --clean --collect-all besapi --onefile ./src/bescli/bescli.py | |
- name: Test bescli binary | |
run: ./dist/bescli ls logout clear error_count version exit |