Update development.yaml #12
Workflow file for this run
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: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.8' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.8' | |
platform: linux/amd64 | |
env: | |
DISTRO: ${{matrix.distro}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
DOCKER_CLIENT_TIMEOUT: "120" | |
COMPOSE_HTTP_TIMEOUT: "120" | |
BASE_IMAGE_HASH: "cb9ea24" | |
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: 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 > "py${PY_VER}-${DISTRO}-${PLATFORM_TAG}.tar.gz" | |
- name: Add image artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{format('py{0}-{1}-{2}', matrix.py_ver, matrix.distro, env.PLATFORM_TAG)}} | |
path: > | |
${{format('py{0}-{1}-{2}.tar.gz', matrix.py_ver, matrix.distro, | |
env.PLATFORM_TAG)}} | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.8' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.8' | |
platform: linux/amd64 | |
env: | |
DISTRO: ${{matrix.distro}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
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('py{0}-{1}-{2}', matrix.py_ver, matrix.distro, env.PLATFORM_TAG)}} | |
- uses: dbhi/qus/action@main | |
with: | |
targets: aarch64 | |
- name: Run integration tests | |
run: | | |
docker load < "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 | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: alpine | |
py_ver: '3.8' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.12' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.11' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.10' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.9' | |
platform: linux/amd64 | |
- distro: debian | |
py_ver: '3.8' | |
platform: linux/amd64 | |
env: | |
DISTRO: ${{matrix.distro}} | |
PY_VER: ${{matrix.py_ver}} | |
PLATFORM: ${{matrix.platform}} | |
DOCKER_USERNAME: ${{secrets.docker_username}} | |
DOCKER_ACCESS_TOKEN: ${{secrets.docker_access_token}} | |
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('py{0}-{1}-{2}', matrix.py_ver, matrix.distro, env.PLATFORM_TAG)}} | |
- name: Publish image | |
run: | | |
echo "$DOCKER_ACCESS_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
docker load < "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.11" ] && [ "$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 "action@github.com" | |
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}} |