Development #110
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: Development | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
# pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: 634d76df5e489c44ade4085552b97bebc786d49245ed1a830022b0b406de5817 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: 634d76df5e489c44ade4085552b97bebc786d49245ed1a830022b0b406de5817 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: ea5e6e8a3d5a0247b9df85382d27220fac8e59b5778fd313c5913879cd9baafc | |
- distro: alpine | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
py_label: py39_ | |
conda_sha256: 9829d95f639bd0053b2ed06d1204e60644617bf37dd5cc57523732e0e8d64516 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
py_label: py38_ | |
conda_sha256: e2a4438671e0e42c5bba14cb51de6ce9763938184d6ca2967340bbe972bbe7e6 | |
- distro: debian | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: 634d76df5e489c44ade4085552b97bebc786d49245ed1a830022b0b406de5817 | |
- distro: debian | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: 634d76df5e489c44ade4085552b97bebc786d49245ed1a830022b0b406de5817 | |
- distro: debian | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
py_label: py310_ | |
conda_sha256: ea5e6e8a3d5a0247b9df85382d27220fac8e59b5778fd313c5913879cd9baafc | |
- distro: debian | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
py_label: py39_ | |
conda_sha256: 9829d95f639bd0053b2ed06d1204e60644617bf37dd5cc57523732e0e8d64516 | |
- distro: debian | |
conda_ver: '23.5.2' | |
conda_suffix: '-0' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
py_label: py38_ | |
conda_sha256: e2a4438671e0e42c5bba14cb51de6ce9763938184d6ca2967340bbe972bbe7e6 | |
env: | |
DISTRO: ${{matrix.distro}} | |
CONDA_VER: ${{matrix.conda_ver}} | |
CONDA_SUFFIX: ${{matrix.conda_suffix}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
PY_LABEL: ${{matrix.py_label}} | |
CONDA_SHA256: ${{matrix.conda_sha256}} | |
DOCKER_CLIENT_TIMEOUT: "120" | |
COMPOSE_HTTP_TIMEOUT: "120" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine platform tag | |
run: | | |
PLATFORM_TAG=$(echo "$PLATFORM" | tr '/' '_') | |
echo "PLATFORM_TAG=${PLATFORM_TAG}" >> $GITHUB_ENV | |
- uses: dbhi/qus/action@main | |
with: | |
targets: aarch64 | |
# - name: Set up QEMU | |
# id: qemu | |
# uses: docker/setup-qemu-action@v1 | |
# with: | |
# image: tonistiigi/binfmt:latest | |
# platforms: all | |
# - name: Set up Docker Buildx | |
# id: buildx | |
# uses: docker/setup-buildx-action@v1 | |
- name: Compile image | |
run: | | |
docker buildx bake -f dist/${DISTRO}/docker-compose.yaml \ | |
--set *.platform=${PLATFORM} --set *.context=. --load | |
REF=$(eval "echo $(cat dist/${DISTRO}/docker-compose.yaml | grep 'image:' | \ | |
awk '{print $2}')") | |
docker save "${REF}" | \ | |
gzip > "${CONDA_VER}-py${PY_VER}-${DISTRO}-${PLATFORM_TAG}.tar.gz" | |
- name: Add image artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: > | |
${{format('{0}-py{1}-{2}-{3}', matrix.conda_ver, matrix.py_ver, matrix.distro, | |
env.PLATFORM_TAG)}} | |
path: > | |
${{format('{0}-py{1}-{2}-{3}.tar.gz', matrix.conda_ver, matrix.py_ver, | |
matrix.distro, env.PLATFORM_TAG)}} | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
package_manager: apk | |
- distro: alpine | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
package_manager: apk | |
- distro: alpine | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
package_manager: apk | |
- distro: alpine | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
package_manager: apk | |
- distro: alpine | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
package_manager: apk | |
- distro: debian | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
package_manager: apt | |
- distro: debian | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
package_manager: apt | |
- distro: debian | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
package_manager: apt | |
- distro: debian | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
package_manager: apt | |
- distro: debian | |
last_build_conda_ver: '22.11.1' | |
conda_ver: '23.5.2' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
package_manager: apt | |
env: | |
DISTRO: ${{matrix.distro}} | |
LAST_BUILD_CONDA_VER: ${{matrix.last_build_conda_ver}} | |
CONDA_VER: ${{matrix.conda_ver}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
PACKAGE_MANAGER: ${{matrix.package_manager}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine platform tag | |
run: | | |
PLATFORM_TAG=$(echo "$PLATFORM" | tr '/' '_') | |
echo "PLATFORM_TAG=${PLATFORM_TAG}" >> $GITHUB_ENV | |
- name: Fetch image artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: > | |
${{format('{0}-py{1}-{2}-{3}', matrix.conda_ver, matrix.py_ver, matrix.distro, | |
env.PLATFORM_TAG)}} | |
- uses: dbhi/qus/action@main | |
with: | |
targets: aarch64 | |
- name: Run integration tests | |
run: | | |
export HOST_UID=$(id -u) | |
docker load < "${CONDA_VER}-py${PY_VER}-${DISTRO}-${PLATFORM_TAG}.tar.gz" | |
tests/main.sh | |
publish: | |
if: | | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
( | |
github.repository_owner == 'datajoint' || | |
github.repository_owner == 'datajoint-company' | |
) | |
needs: test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
conda_ver: '23.5.2' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: alpine | |
conda_ver: '23.5.2' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
- distro: debian | |
conda_ver: '23.5.2' | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: debian | |
conda_ver: '23.5.2' | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: debian | |
conda_ver: '23.5.2' | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: debian | |
conda_ver: '23.5.2' | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: debian | |
conda_ver: '23.5.2' | |
py_ver: '3.8' | |
platform: linux/amd64 | |
env: | |
DISTRO: ${{matrix.distro}} | |
CONDA_VER: ${{matrix.conda_ver}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
DOCKER_USERNAME: ${{secrets.docker_username}} | |
DOCKER_PASSWORD: ${{secrets.docker_password}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine platform tag | |
run: | | |
PLATFORM_TAG=$(echo "$PLATFORM" | tr '/' '_') | |
echo "PLATFORM_TAG=${PLATFORM_TAG}" >> $GITHUB_ENV | |
- name: Fetch image artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: > | |
${{format('{0}-py{1}-{2}-{3}', matrix.conda_ver, matrix.py_ver, matrix.distro, | |
env.PLATFORM_TAG)}} | |
- name: Publish image | |
run: | | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
docker load < "${CONDA_VER}-py${PY_VER}-${DISTRO}-${PLATFORM_TAG}.tar.gz" | |
REF=$(eval "echo $(cat dist/${DISTRO}/docker-compose.yaml | grep 'image:' | \ | |
awk '{print $2}')") | |
TAG=$(echo $REF | awk -F':' '{print $2}') | |
IMAGE=$(echo $REF | awk -F':' '{print $1}') | |
docker push "${IMAGE}:${TAG}" | |
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}" | |
docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}" | |
[ "$PY_VER" == "3.12" ] && [ "$DISTRO" == "debian" ] \ | |
&& docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \ | |
&& docker push "${IMAGE}:latest" \ | |
|| echo "skipping 'latest' tag..." | |
publish-docs: | |
if: | | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
( | |
github.repository_owner == 'datajoint' || | |
github.repository_owner == 'datajoint-company' | |
) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build docs | |
uses: ammaraskar/sphinx-action@master | |
with: | |
docs-folder: "docs/" | |
# - name: Upload docs artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: docs-html | |
# path: docs/_build/html/ | |
# retention-days: 1 | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/${GITHUB_REPOSITORY}.git \ | |
--branch gh-pages --single-branch gh-pages | |
rm -R gh-pages/* | |
cp -r docs/_build/html/* gh-pages/ | |
cp .gitignore gh-pages/ | |
touch gh-pages/.nojekyll | |
cd gh-pages | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . --all | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# the return code. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{secrets.GITHUB_TOKEN}} |