Skip to content

Bump actions/checkout from 3 to 4 (#5) #17

Bump actions/checkout from 3 to 4 (#5)

Bump actions/checkout from 3 to 4 (#5) #17

Workflow file for this run

---
name: Build-Publish
on:
push:
branches: ["**"]
tags-ignore: ["**"]
release:
types: [released]
jobs:
build-publish:
name: "Python-${{ matrix.PYTHON }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PYTHON:
- 3.5.10
- 3.6.15
- 3.7.16
- 3.8.16
- 3.9.16
- 3.10.9
- 3.11.1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Variables
id: vars
run: |
# Extract python subversion
PYTHON_MAJOR=$(echo $PYTHON | sed 's/\.[0-9]\+$//')
PYTHON_PATCH=$(echo $PYTHON | sed 's/^[0-9]\+\.[0-9]\+\.//')
# Build Docker image tag
if [ "${{ github.ref_type }}" = "tag" ]; then
TAG="${PYTHON_MAJOR}"
else
TAG="${PYTHON}"
fi
# Output for debugging
echo "TAG=${TAG}"
# Store GitHub Action env vars
echo "PYTHON_MAJOR=${PYTHON_MAJOR}" >> "${GITHUB_ENV}"
echo "PYTHON_PATCH=${PYTHON_PATCH}" >> "${GITHUB_ENV}"
echo "TAG=${TAG}" >> "${GITHUB_ENV}"
env:
PYTHON: ${{ matrix.PYTHON }}
- name: Build
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep 2;
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make build PYTHON_MAJOR=${PYTHON_MAJOR} PYTHON_PATCH=${PYTHON_PATCH}
env:
RETRIES: 5
- name: Test
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep 2;
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make test PYTHON_MAJOR=${PYTHON_MAJOR} PYTHON_PATCH=${PYTHON_PATCH}
env:
RETRIES: 5
- name: Tag
run: |
make tag TAG=${TAG}
docker images
- name: Login
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep 2;
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make login DOCKER_USER=${{ secrets.DOCKER_USERNAME }} DOCKER_PASS=${{ secrets.DOCKER_PASSWORD }}
env:
RETRIES: 5
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
&& (
(github.event_name == 'schedule' && github.ref_name == 'master')
||
(github.event_name == 'push' && github.ref_name == 'master')
||
(github.event_name == 'release' && github.event.action == 'released')
)
- name: Push
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep 2;
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
retry make push TAG=${TAG}
env:
RETRIES: 5
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
&& (
(github.event_name == 'schedule' && github.ref_name == 'master')
||
(github.event_name == 'push' && github.ref_name == 'master')
||
(github.event_name == 'release' && github.event.action == 'released')
)