Fix pylint issue and deprecation warnings from datetime in Python 3.12. #223
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: Build and Test Package | |
on: [push, pull_request] | |
jobs: | |
build-sdist: | |
name: Build Source Dist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Tools | |
run: | | |
python .github/scripts/parse_pyproject_toml.py --section build-system --key requires --array --string > pyproj-requires.txt | |
pip install -r pyproj-requires.txt | |
- name: Source Packaging | |
run: | | |
python setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sdist | |
path: 'dist/**' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: test-files | |
path: | | |
spotfire/test/files/** | |
spotfire/requirements.txt | |
test_requirements_*.txt | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: analysis-files | |
path: | | |
pylintrc | |
requirements_lint.txt | |
- name: Dynamic Elements | |
id: dynamic | |
run: | | |
echo -n "test-envs=[" >> $GITHUB_OUTPUT | |
ls test_requirements_* | sed -e 's/test_requirements_/"/' -e 's/.txt/"/' | tr '\n' ',' | sed -e 's/,$//' >> $GITHUB_OUTPUT | |
echo "]" >> $GITHUB_OUTPUT | |
echo -n "pythons=" >> $GITHUB_OUTPUT | |
cat .github/python-versions.json >> $GITHUB_OUTPUT | |
outputs: | |
test-environments: ${{ steps.dynamic.outputs.test-envs }} | |
python-versions: ${{ steps.dynamic.outputs.pythons }} | |
build-wheel: | |
name: Build Wheels | |
needs: build-sdist | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
python-version: ${{ fromJson(needs.build-sdist.outputs.python-versions) }} | |
operating-system: ['ubuntu-latest', 'windows-latest'] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Build Requirements | |
run: | | |
python .github/scripts/parse_pyproject_toml.py --section build-system --key requires --array --string > pyproj-requires.txt | |
pip install auditwheel -r pyproj-requires.txt | |
- name: Build Wheel | |
run: | | |
python setup.py bdist_wheel | |
- name: Convert Wheel to Manylinux | |
if: ${{ matrix.operating-system == 'ubuntu-latest' }} | |
run: | | |
mv dist/*.whl . | |
auditwheel repair -w dist --plat manylinux2014_x86_64 ./*.whl | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheel-${{ matrix.python-version }}-${{ matrix.operating-system }} | |
path: 'dist/**' | |
test: | |
name: Test | |
needs: [build-sdist, build-wheel] | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
python-version: ${{ fromJson(needs.build-sdist.outputs.python-versions) }} | |
operating-system: ['ubuntu-latest', 'windows-latest'] | |
test-environment: ${{ fromJson(needs.build-sdist.outputs.test-environments) }} | |
fail-fast: false | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheel-${{ matrix.python-version }}-${{ matrix.operating-system }} | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: test-files | |
path: test-files | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies (Linux) | |
if: matrix.operating-system == 'ubuntu-latest' | |
run: | | |
pip install dist/*.whl -r test-files/test_requirements_${{ matrix.test-environment }}.txt | |
- name: Install Dependencies (Windows) | |
if: matrix.operating-system == 'windows-latest' | |
run: | | |
pip install $((dir dist\*.whl).FullName) -r test-files/test_requirements_${{ matrix.test-environment }}.txt | |
- name: Run Tests | |
run: | | |
python -m spotfire.test | |
env: | |
RESULTS_NAME: ${{ matrix.python-version }}-${{ matrix.operating-system }}-${{ matrix.test-environment }} | |
TEST_FILES_DIR: ${{ github.workspace }}/test-files/spotfire/test/files | |
- uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: test-results-${{ matrix.python-version }}-${{ matrix.operating-system }}-${{ matrix.test-environment }} | |
path: 'results-*.xml' | |
lint: | |
name: Static Analysis | |
needs: [build-sdist, build-wheel] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Process Python Version | |
id: version | |
run: | | |
echo -n "python-version=" >> $GITHUB_OUTPUT | |
# echo '${{ needs.build-sdist.outputs.python-versions }}' | sed -e 's/[^"]*"//' -e 's/".*//' >> $GITHUB_OUTPUT | |
echo 3.11 >> $GITHUB_OUTPUT # XXX Frozen version of pylint does not work with 3.12. (See comment on #38 for more info.) | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ steps.version.outputs.python-version }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheel-${{ steps.version.outputs.python-version }}-ubuntu-latest | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: analysis-files | |
- name: Install Tools | |
run: | | |
pip install dist/*.whl -r requirements_lint.txt | |
- name: Static Analysis with pylint | |
run: | | |
pylint spotfire |