Skip to content

Commit

Permalink
Use latest actions and simplify variables/steps in GitHub Actions wor…
Browse files Browse the repository at this point in the history
…kflow.
  • Loading branch information
lapets committed Oct 31, 2023
1 parent e947a74 commit fafa74b
Showing 1 changed file with 66 additions and 69 deletions.
135 changes: 66 additions & 69 deletions .github/workflows/lint-test-cover-docs-build-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,35 @@ on:
jobs:
manylinux:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
strategy:
matrix:
python:
- {version: '3.7', version-abi: 'cp37', version-abi-suffix: 'cp37m'}
- {version: '3.8', version-abi: 'cp38', version-abi-suffix: 'cp38'}
- {version: '3.9', version-abi: 'cp39', version-abi-suffix: 'cp39'}
- {version: '3.10', version-abi: 'cp310', version-abi-suffix: 'cp310'}
- {version: '3.11', version-abi: 'cp311', version-abi-suffix: 'cp311'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.version-abi }} for manylinux2014_x86_64
- {version: '3.7', abi: 'cp37'}
- {version: '3.8', abi: 'cp38'}
- {version: '3.9', abi: 'cp39'}
- {version: '3.10', abi: 'cp310'}
- {version: '3.11', abi: 'cp311'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }} for manylinux2014_x86_64
env:
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.version-abi }}-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64
steps:
- uses: actions/checkout@v3
- name: Install development dependencies.
run: |
yum -y install wget libffi-devel
- uses: actions/checkout@v4
- name: Install Python.
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
architecture: x64
- name: Download libsodium source tree archive.
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
- name: Install Python.
run: |
/opt/python/${{ matrix.python.version-abi }}-${{ matrix.python.version-abi-suffix }}/bin/python -m pip install virtualenv
/opt/python/${{ matrix.python.version-abi }}-${{ matrix.python.version-abi-suffix }}/bin/python -m virtualenv .venv
- name: Install Python dependencies for build process.
run: |
.venv/bin/pip install -U pip .[build]
pip install .[build]
- name: Build wheel file.
run: |
mkdir tmpwheelhouse
LIBSODIUM_MAKE_ARGS="-j$(nproc)" .venv/bin/python -m build --wheel
LIBSODIUM_MAKE_ARGS="-j$(nproc)" python -m build --wheel
mv dist/bcl*.whl tmpwheelhouse
mkdir wheelhouse
mv tmpwheelhouse/bcl*.whl wheelhouse/
Expand All @@ -45,30 +42,30 @@ jobs:
.venv/bin/pip install -f wheelhouse --no-index --force-reinstall --no-dependencies bcl
- name: Lint and test module (and compiled libsodium shared library file).
run: |
.venv/bin/pip install -U .[lint,test]
.venv/bin/python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py --disable=duplicate-code # Check against linting rules.
.venv/bin/python src/bcl/bcl.py -v # Run doctests.
.venv/bin/python -m pytest # Run tests.
pip install -U .[lint,test]
python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py --disable=duplicate-code # Check against linting rules.
python src/bcl/bcl.py -v # Run doctests.
python -m pytest # Run tests.
- name: Publish coverage results.
run: |
.venv/bin/pip install -U .[coveralls]
.venv/bin/python -m coveralls --service=github # Submit to coveralls.
pip install -U .[coveralls]
python -m coveralls --service=github # Submit to coveralls.
if: matrix.python.version == '3.11'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Test auto-generation of documentation.
run: |
.venv/bin/pip install -U .[docs]
pip install -U .[docs]
cd docs
../.venv/bin/sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
make html SPHINXBUILD='../.venv/bin/sphinx-build'
sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
make html
cd ..
- name: Upload wheel file.
run: |
mkdir bcl-wheelhouse
mv wheelhouse/bcl*.whl bcl-wheelhouse/${{ env.WHEELNAME }}.whl
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: ${{ env.WHEELNAME }}
path: bcl-wheelhouse/
Expand All @@ -77,24 +74,24 @@ jobs:
strategy:
matrix:
python:
- {version: '3.7', version-abi: 'cp37', version-url: '3.7.9'}
- {version: '3.8', version-abi: 'cp38', version-url: '3.8.9'}
- {version: '3.9', version-abi: 'cp39', version-url: '3.9.9'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.version-abi }} for macOS 10.9
- {version: '3.7', abi: 'cp37', url: '3.7.9'}
- {version: '3.8', abi: 'cp38', url: '3.8.9'}
- {version: '3.9', abi: 'cp39', url: '3.9.9'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }} for macOS 10.9
env:
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.version-abi }}-abi3-macosx_10_9_x86_64
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-macosx_10_9_x86_64
steps:
- uses: actions/checkout@v3
- name: Download libsodium source tree archive.
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
- uses: actions/checkout@v4
- name: Install Python.
run: |
curl "https://www.python.org/ftp/python/${{ matrix.python.version-url }}/python-${{ matrix.python.version-url }}-macosx10.9.pkg" -o python.pkg
curl "https://www.python.org/ftp/python/${{ matrix.python.url }}/python-${{ matrix.python.url }}-macosx10.9.pkg" -o python.pkg
sudo installer -pkg python.pkg -target /
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 -m pip install -U virtualenv
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 -m virtualenv venv
- name: Download libsodium source tree archive.
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
- name: Install Python dependencies for build process.
run: |
venv/bin/pip install -U pip .[build]
Expand Down Expand Up @@ -125,7 +122,7 @@ jobs:
run: |
mkdir bcl-wheelhouse
mv wheelhouse/bcl*.whl bcl-wheelhouse/${{ env.WHEELNAME }}.whl
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: ${{ env.WHEELNAME }}
path: bcl-wheelhouse/
Expand All @@ -134,24 +131,24 @@ jobs:
strategy:
matrix:
python:
- {version: '3.9', version-abi: 'cp39', version-url: '3.9.9'}
- {version: '3.10', version-abi: 'cp310', version-url: '3.10.6'}
- {version: '3.11', version-abi: 'cp311', version-url: '3.11.3'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.version-abi }} for macOS 11 ARM
- {version: '3.9', abi: 'cp39', url: '3.9.9'}
- {version: '3.10', abi: 'cp310', url: '3.10.6'}
- {version: '3.11', abi: 'cp311', url: '3.11.3'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }} for macOS 11 ARM
env:
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.version-abi }}-abi3-macosx_10_10_universal2
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-macosx_10_10_universal2
steps:
- uses: actions/checkout@v3
- name: Download libsodium source tree archive.
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
- uses: actions/checkout@v4
- name: Install Python.
run: |
curl "https://www.python.org/ftp/python/${{ matrix.python.version-url }}/python-${{ matrix.python.version-url }}-macos11.pkg" -o python.pkg
curl "https://www.python.org/ftp/python/${{ matrix.python.url }}/python-${{ matrix.python.url }}-macos11.pkg" -o python.pkg
sudo installer -pkg python.pkg -target /
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 -m pip install -U virtualenv
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 -m virtualenv venv
- name: Download libsodium source tree archive.
run: |
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
- name: Install Python dependencies for build process.
run: |
venv/bin/pip install -U pip .[build]
Expand Down Expand Up @@ -182,7 +179,7 @@ jobs:
run: |
mkdir bcl-wheelhouse
mv wheelhouse/bcl*.whl bcl-wheelhouse/${{ env.WHEELNAME }}.whl
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: ${{ env.WHEELNAME }}
path: bcl-wheelhouse/
Expand All @@ -194,31 +191,31 @@ jobs:
- {version: 'win32', arch: 'x86', arch-sodium: 'Win32', arch-vs: 'x86'}
- {version: 'win_amd64', arch: 'x64', arch-sodium: 'x64', arch-vs: 'amd64'}
python:
- {version: '3.7', version-abi: 'cp37'}
- {version: '3.8', version-abi: 'cp38'}
- {version: '3.9', version-abi: 'cp39'}
- {version: '3.10', version-abi: 'cp310'}
- {version: '3.11', version-abi: 'cp311'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.version-abi }} for Windows ${{ matrix.windows.arch }}
- {version: '3.7', abi: 'cp37'}
- {version: '3.8', abi: 'cp38'}
- {version: '3.9', abi: 'cp39'}
- {version: '3.10', abi: 'cp310'}
- {version: '3.11', abi: 'cp311'}
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }} for Windows ${{ matrix.windows.arch }}
env:
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.version-abi }}-abi3-${{ matrix.windows.version }}
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-${{ matrix.windows.version }}
INCLUDE: C:\libsodium\include
LIB: C:\libsodium\${{ matrix.windows.arch-sodium }}\Release\v142\dynamic\
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Python.
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
architecture: ${{ matrix.windows.arch }}
- name: Download and extract libsodium dynamic library file.
run: |
wget -O C:\libsodium-1.0.18-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-msvc.zip
Expand-Archive C:\libsodium-1.0.18-msvc.zip -DestinationPath C:\
shell: powershell
- name: Install Python.
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
architecture: ${{ matrix.windows.arch }}
- name: Install Python dependencies for build process.
run: |
python -m pip install -U pip .[build]
pip install -U pip .[build]
shell: bash
- name: Build wheel file.
run: |
Expand All @@ -234,14 +231,14 @@ jobs:
shell: bash
- name: Lint and test module (and compiled libsodium shared library file).
run: |
python -m pip install -U pip .[lint,test]
pip install -U pip .[lint,test]
python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py --disable=duplicate-code # Check against linting rules.
python src/bcl/bcl.py -v # Run doctests.
python -m pytest # Run tests.
shell: bash
- name: Test auto-generation of documentation.
run: |
python -m pip install -U .[docs]
pip install -U .[docs]
cd docs
sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
make html
Expand All @@ -252,7 +249,7 @@ jobs:
mkdir bcl-wheelhouse
move wheelhouse\bcl*.whl bcl-wheelhouse\${{ env.WHEELNAME }}.whl
shell: cmd
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: ${{ env.WHEELNAME }}
path: bcl-wheelhouse\

0 comments on commit fafa74b

Please sign in to comment.