Skip to content

Commit

Permalink
maint: simplify build tests to latest standards
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Sep 8, 2022
1 parent 87a9acf commit 5ebe6dd
Showing 1 changed file with 38 additions and 41 deletions.
79 changes: 38 additions & 41 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,77 +12,74 @@ on:

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
if: "!startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
pip: ["pip==21.2", "pip~=22.0"]

steps:
- uses: actions/checkout@v2
- name: Fetch all tags (for setuptools_scm to work)
run: |
/usr/bin/git -c protocol.version=2 fetch --tags --prune --unshallow origin
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
ssh-key: "${{ secrets.NIPREPS_DEPLOY }}"
fetch-depth: 0
- name: Build in confined, updated environment and interpolate version
path: $HOME/.cache/pip
key: pip-cache-v1
restore-keys: |
pip-cache-
- name: Build in confined environment and interpolate version
run: |
python -m venv /tmp/buildenv
source /tmp/buildenv/bin/activate
python -m pip install -U setuptools pip wheel twine docutils
python setup.py sdist bdist_wheel
python -m twine check dist/sdcflows*
python -m pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils
python -m build -s -w
python -m twine check dist/sdcflows-*
mv dist /tmp/package
rm -rf sdcflows.egg-info/
# Interpolate version
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG=${GITHUB_REF##*/}
fi
THISVERSION=$( python setup.py --version )
THISVERSION=$( python -m setuptools_scm )
THISVERSION=${TAG:-$THISVERSION}
echo "Expected VERSION: \"${THISVERSION}\""
echo "THISVERSION=${THISVERSION}" >> ${GITHUB_ENV}
echo "THISVERSION=${THISVERSION}" >> $GITHUB_ENV
- name: Install in confined environment [pip]
run: |
python -m venv /tmp/pip
source /tmp/pip/bin/activate
python -m pip install -U "setuptools >= 45" "setuptools_scm >= 6.2" "${{ matrix.pip }}"
python -m pip install .
INSTALLED_VERSION=$(python -c 'import sdcflows as sdc; print(sdc.__version__, end="")')
echo "VERSION: \"${THISVERSION}\""
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [sdist]
run: |
python -m venv /tmp/install_sdist
source /tmp/install_sdist/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install dist/sdcflows*.tar.gz
INSTALLED_VERSION=$(python -c 'import sdcflows; print(sdcflows.__version__, end="")')
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
python -m pip install /tmp/package/sdcflows*.tar.gz
INSTALLED_VERSION=$(python -c 'import sdcflows as sdc; print(sdc.__version__, end="")')
echo "VERSION: \"${THISVERSION}\""
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [wheel]
run: |
python -m venv /tmp/install_wheel
source /tmp/install_wheel/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install dist/sdcflows*.whl
INSTALLED_VERSION=$(python -c 'import sdcflows; print(sdcflows.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [pip install .]
run: |
python -m venv /tmp/setup_install
source /tmp/setup_install/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install .
INSTALLED_VERSION=$(python -c 'import sdcflows; print(sdcflows.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [pip install -e .]
run: |
python -m venv /tmp/setup_develop
source /tmp/setup_develop/bin/activate
python -m pip install pip
python -m pip install --upgrade pip wheel
python -m pip install -e .
INSTALLED_VERSION=$(python -c 'import sdcflows; print(sdcflows.__version__, end="")')
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
python -m pip install /tmp/package/sdcflows*.whl
INSTALLED_VERSION=$(python -c 'import sdcflows as sdc; print(sdc.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
Expand Down

0 comments on commit 5ebe6dd

Please sign in to comment.