Update configparser SafeConfigParser and readfp, new in python 3.12 #1
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: CI | |
on: | |
push: | |
paths-ignore: | |
- "README.md" | |
- "**/docs/**" | |
- ".github/workflows/docs.yml" | |
pull_request: | |
branches: | |
- master | |
- dev | |
schedule: | |
- cron: "0 11 * * *" | |
jobs: | |
skip_duplicate: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
github_token: ${{ github.token }} | |
concurrent_skipping: never | |
skip_after_successful_duplicate: true | |
paths_ignore: '["**/README.md", "**/docs/**"]' | |
do_not_skip: '["pull_request", "schedule"]' | |
test-pip: | |
name: Test on Pip | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9","3.10","3.11"] | |
os: ["ubuntu-latest", "macos-latest", "macos-12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel setuptools numpy | |
# Temp fix due to speclite not supporting the latest version | |
pip install "matplotlib<3.9" | |
if [[ ${{matrix.os}} == macos-latest ]]; | |
then | |
brew update | |
brew install hdf5 | |
fi | |
if [[ "${ISDEV}" == "true" ]]; then | |
pip install --upgrade --pre astromodels | |
else | |
pip install --upgrade astromodels | |
fi | |
pip install --upgrade flake8 coverage pytest-cov cython | |
pip install -e . | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- 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 | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test pip on ${{ matrix.python-version }} | |
run: | | |
python -m pytest -vv --cov=threeML --cov-report=xml | |
env: | |
PYTEST_ADDOPTS: "--color=yes" | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
test-dev: | |
name: Test on Pip against astromodels-dev | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9","3.10","3.11"] | |
os: [ "ubuntu-latest", "macos-latest", "macos-12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
# Temp fix due to speclite not supporting the latest version | |
pip install "matplotlib<3.9" | |
if [[ ${{matrix.os}} == macos-latest ]]; | |
then | |
brew update | |
brew install hdf5 | |
fi | |
git clone https://github.com/threeML/astromodels | |
cd astromodels | |
git checkout dev | |
python -m pip install -e . | |
cd .. | |
pip install --upgrade flake8 coverage pytest-cov cython | |
pip install -e . | |
- 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 | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test pip on ${{ matrix.python-version }} | |
run: | | |
python -m pytest -vv --cov=threeML --cov-report=xml | |
env: | |
PYTEST_ADDOPTS: "--color=yes" | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
test-conda: | |
name: Test on Conda | |
needs: skip_duplicate | |
if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-12"] | |
python-version: [3.9] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: XCode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest | |
if: runner.os == 'macOS' | |
#- name: Cache conda | |
# uses: actions/cache@v2 | |
# env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
# CACHE_NUMBER: 0 | |
# with: | |
# path: ~/conda_pkgs_dir | |
# key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('ci/environment.yml') }} | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
auto-activate-base: false | |
#miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: test_env | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge, xspecmodels, threeml, fermi, defaults | |
environment-file: ci/environment.yml | |
use-only-tar-bz2: true | |
- name: Init Env | |
shell: bash -l {0} | |
run: | | |
export PKG_VERSION=$(python -c "import versioneer;print(versioneer.get_version())") | |
echo "HOME= ${HOME}" | |
echo "Building ${PKG_VERSION} ..." | |
echo "Python version: ${{matrix.python-version}}" | |
echo "Running on development branch: ${ISDEV} " | |
if [[ "${ISDEV}" == "true" ]]; then | |
mamba install -c conda-forge -c threeml/label/dev "threeml/label/dev::astromodels" | |
fi | |
pip install --upgrade speclite | |
pip install fermipy "matplotlib<3.9" | |
env: | |
ISDEV: ${{contains(github.ref, 'dev') || contains(github.base_ref, 'dev')}} | |
- name: Conda list | |
shell: bash -l {0} | |
run: | | |
conda list | |
- name: install it | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: test it | |
shell: bash -l {0} | |
run: | | |
wget https://raw.githubusercontent.com/fermi-lat/pyBurstAnalysisGUI/master/python/GtBurst/updater.py -O $CONDA_PREFIX/lib/python${{ matrix.python-version }}/site-packages/fermitools/GtBurst/updater.py | |
python $CONDA_PREFIX/lib/python${{ matrix.python-version }}/site-packages/fermitools/GtBurst/updater.py | |
python -m pytest -vv --cov=threeML --cov-report=xml | |
env: | |
PYTEST_ADDOPTS: "--color=yes" | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
NUMEXPR_NUM_THREADS: 1 | |
MPLBACKEND: "Agg" | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
files: ./coverage1.xml,./coverage2.xml | |
Directory: ./coverage/reports/ | |
publish-pypi: | |
name: Publish to PyPi | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Build package | |
run: | | |
pip install wheel setuptools -U | |
python setup.py sdist bdist_wheel | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
test-publish-pypi: | |
name: Build & verify package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install twine | |
run: | | |
python -m pip install twine | |
pip install wheel setuptools -U | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: List result | |
run: | | |
ls -lh dist | |
- name: Check long_description | |
run: | | |
python -m twine check dist/* |