update main title #204
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 | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
release: | |
types: [ published ] | |
jobs: | |
test_and_build: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { os: ubuntu-latest, py: 3.7, doc: 1, whl: 1 } | |
- { os: windows-latest, py: 3.7, exe: 1, whl: 1 } | |
# pure python wheels | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.config.py }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.config.py }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel setuptools | |
python -m pip install numpy scipy matplotlib bumps periodictable scikit-learn pytest pytest-cov numba | |
python setup.py build | |
mkdir release | |
- name: Run tests | |
run: | | |
pytest -v | |
python check_examples.py --chisq | |
env: | |
MPLBACKEND: agg | |
- name: Check that the docs build (linux only) | |
if: matrix.config.doc == 1 | |
run: | | |
python -m pip install sphinx | |
make -j 4 -C doc SPHINXOPTS="-W --keep-going" html | |
- name: Build binary wheel | |
if: matrix.config.whl == 1 | |
run: | | |
python setup.py bdist_wheel | |
- name: Build installer | |
if: matrix.config.exe == 1 | |
run: | | |
pwsh -command ".\$GITHUB_WORKSPACE\extra\build_win_installer.ps1" | |
mv dist\Refl1D*.zip release\ | |
- name: Build source distribution | |
if: matrix.config.whl != 1 | |
run: | | |
python setup.py sdist | |
# See the following for how to upload to a release | |
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/ | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
dist/*.whl | |
dist/*.zip | |
dist/*.tar.gz | |
release/*.zip | |
publish: | |
needs: test_and_build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Retrieve all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
- name: show files | |
run: | | |
ls * -l | |
echo "WINDOWS_INSTALLER=$(ls release/*.zip)" >> $GITHUB_ENV | |
echo "SRC_DIST=$(ls dist/*.tar.gz)" >> $GITHUB_ENV | |
echo "PY3_WHL=$(ls dist/*.whl)" >> $GITHUB_ENV | |
- name: Update current release | |
if: startsWith(github.ref, 'refs/tags') | |
uses: johnwbyrd/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
${{ env.WINDOWS_INSTALLER }} | |
${{ env.PY3_WHL }} | |
- name: publish distribution to Test PyPI | |
env: | |
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
if: env.TEST_PYPI_API_TOKEN != null | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
skip_existing: true | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |