Main workflow #905
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: Main workflow | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '5 14 * * *' | |
jobs: | |
check-version-numbers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check version numbers | |
run: ./version.sh | |
package-python: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-11 | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install dependencies (libtool, aclocal, autoconf) | |
run: | | |
if [ "$RUNNER_OS" = "Linux" ]; then | |
sudo apt-get install libtool automake | |
elif [ "$RUNNER_OS" = "macOS" ]; then | |
brew install libtool autoconf automake | |
else | |
echo Unsupported RUNNER_OS=$RUNNER_OS | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- name: Upload binary wheel | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ format('bdist.{0}', matrix.os) }} | |
path: wheelhouse/libdash-*.whl | |
- name: Build source distribution (Linux only) | |
if: contains(matrix.os, 'ubuntu') | |
run: python setup.py sdist | |
- name: Upload source distribution (from Linux) | |
uses: actions/upload-artifact@v2 | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
name: sdist | |
path: dist/libdash-*.tar.gz | |
build-both-and-compare: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- macos-12 | |
- macos-11 | |
- ubuntu-latest | |
ocaml-compiler: | |
- 4.14.x | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use OCaml ${{ matrix.ocaml-compiler }} | |
uses: avsm/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
dune-cache: true | |
- name: Install and test OCaml bindings | |
run: opam install --with-test --working-dir . | |
# we don't reuse the wheels so that all of the CI runs can happen concurrently | |
- name: Install Python directly | |
run: sudo pip3 install . | |
- name: Test Python bindings | |
run: make -C python test | |
- name: Compare OCaml and Python bindings | |
run: opam exec -- make -C test test | |
deploy: | |
needs: | |
- check-version-numbers | |
- package-python | |
- build-both-and-compare | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Download distributions | |
uses: actions/download-artifact@v2 | |
- name: Rename distributions | |
run: | | |
mkdir dist | |
ls bdist.*/ | |
mv bdist.*/libdash-*.whl dist/ | |
mv sdist/libdash-*.tar.gz dist/ | |
echo Look on my Works, ye Mighty, and despair! | |
ls dist | |
- name: Deploy 'latest' release on GH | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Python source and binary distributions" | |
files: | | |
dist/* | |
- name: Deploy test distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
verbose: true | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
- name: Deploy tagged release on PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true |