build(deps): update deps on version 0.13.2 #917
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: CI Pipeline | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "*.*.*" | |
paths: | |
- "**" | |
- "!docs/**" | |
- "!examples/**" | |
- "!interaction_experiments/**" | |
- "!k8s/**" | |
pull_request: | |
paths: | |
- "**" | |
- "!docs/**" | |
- "!examples/**" | |
- "!interaction_experiments/**" | |
- "!k8s/**" | |
env: | |
TERM: xterm | |
# enable Docker push only if the required secrets are defined | |
ENABLE_DOCKER_PUSH: ${{ secrets.DOCKERHUB_USER != null && secrets.DOCKERHUB_TOKEN != null }} | |
jobs: | |
# Verifies pep8, pyflakes and circular complexity | |
flake8: | |
name: Lint Python Code (Flake8) (python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set up Python v${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install flake8 | |
run: pip install flake8 | |
- name: Run checks | |
run: flake8 -v . | |
# Validate OpenAPI specs | |
openapi_specs: | |
name: Lint OpenAPI Specs (python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set up Python v${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install OpenAPI Spec Validator | |
run: pip install openapi-spec-validator | |
- name: Run checks | |
run: openapi-spec-validator specs/api.yaml | |
build: | |
name: "Build, Test and Push Docker Image" | |
runs-on: ubuntu-latest | |
needs: [flake8, openapi_specs] | |
steps: | |
- name: "List Docker images" | |
run: "docker images" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Generate certificates | |
run: make certs | |
# So now you can use Actions' own caching! | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: "Set software version" | |
run: | | |
git fetch --unshallow | |
sw_version=$(python3 -c 'import lifemonitor; print(lifemonitor.__version__)') | |
echo "Current Software Version: ${sw_version}" | |
echo "SOFTWARE_VERSION=${sw_version}" >> $GITHUB_ENV | |
echo "SOFTWARE_VERSION_AS_DOCKER_TAG=$( echo ${sw_version} | tr + _ )" >> $GITHUB_ENV | |
echo "USE_SOFTWARE_VERSION=$( if [[ $(git tag --points-at HEAD) ]]; then echo true; else echo false; fi )" >> $GITHUB_ENV | |
# Set Docker image | |
- name: Set Docker repository | |
run: | | |
echo "DOCKERHUB_REPO=$( if [[ -n "${{ secrets.DOCKERHUB_REPO }}" ]]; then | |
echo "${{ secrets.DOCKERHUB_REPO }}"; | |
else echo "${{ github.repository_owner }}/lifemonitor"; fi )" >> $GITHUB_ENV | |
# Extract Docker metadata and set labels and tags | |
- name: Extract Docker metadata | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.DOCKERHUB_REPO }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,enable=${{env.USE_SOFTWARE_VERSION}},pattern={{version}} | |
type=semver,enable=${{env.USE_SOFTWARE_VERSION}},event=tag,pattern={{major}}.{{minor}} | |
type=semver,enable=${{env.USE_SOFTWARE_VERSION}},pattern={{major}}.{{minor}}.build${{ github.run_number }} | |
type=raw,event=tag,value=${{ env.SOFTWARE_VERSION_AS_DOCKER_TAG }} | |
type=raw,event=tag,value=${{ env.SOFTWARE_VERSION_AS_DOCKER_TAG}}.build${{ github.run_number }} | |
type=sha | |
labels: | | |
org.opencontainers.image.version=${{ env.SOFTWARE_VERSION }}.build${{ github.run_number }} | |
# Build and tag LifeMonitor Docker image | |
- name: Build Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/lifemonitor.Dockerfile | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
load: true | |
build-args: | | |
SW_VERSION=${{ env.SOFTWARE_VERSION }} | |
BUILD_NUMBER=${{ github.run_number }} | |
- name: Update cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
# Setup testing environment | |
- name: Set up testing environment | |
# Tag the latest built image as `crs4/lifemonitor:latest` | |
# which is the default used by `make run-tests` to run tests | |
run: | | |
docker images ; | |
docker tag ${{ env.DOCKERHUB_REPO }}:${{ env.SOFTWARE_VERSION_AS_DOCKER_TAG }} crs4/lifemonitor:latest ; | |
docker images ; | |
SKIP_BUILD=1 SW_VERSION=${{ env.SOFTWARE_VERSION }} BUILD_NUMBER=${{ github.run_number }} make start-testing | |
env: | |
TRAVIS_TESTING_SERVICE_URL: ${{ secrets.TRAVIS_TESTING_SERVICE_URL }} | |
TRAVIS_TESTING_SERVICE_TOKEN: ${{ secrets.TRAVIS_TESTING_SERVICE_TOKEN }} | |
TRAVIS_TESTING_SERVICE_TYPE: travis | |
GH_TESTING_SERVICE_URL: ${{ secrets.GH_TESTING_SERVICE_URL }} | |
GH_TESTING_SERVICE_TOKEN: ${{ secrets.GH_TESTING_SERVICE_TOKEN }} | |
GH_TESTING_SERVICE_TYPE: github | |
# Run tests | |
- name: Run tests | |
run: SKIP_BUILD=1 SKIP_RESET_COMPOSE=1 SW_VERSION=${{ env.SOFTWARE_VERSION }} BUILD_NUMBER=${{ github.run_number }} make run-tests | |
env: | |
TRAVIS_TESTING_SERVICE_URL: ${{ secrets.TRAVIS_TESTING_SERVICE_URL }} | |
TRAVIS_TESTING_SERVICE_TOKEN: ${{ secrets.TRAVIS_TESTING_SERVICE_TOKEN }} | |
TRAVIS_TESTING_SERVICE_TYPE: travis | |
GH_TESTING_SERVICE_URL: ${{ secrets.GH_TESTING_SERVICE_URL }} | |
GH_TESTING_SERVICE_TOKEN: ${{ secrets.GH_TESTING_SERVICE_TOKEN }} | |
GH_TESTING_SERVICE_TYPE: github | |
# Teardown testing environment | |
- name: Teardown testing environment | |
run: make down | |
# Log in to DockerHub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: ${{ env.ENABLE_DOCKER_PUSH == 'true' }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Push LifeMonitor Docker image | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
if: ${{ env.ENABLE_DOCKER_PUSH == 'true' }} | |
with: | |
context: . | |
file: docker/lifemonitor.Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
build-args: | | |
SW_VERSION=${{ env.SOFTWARE_VERSION }} | |
BUILD_NUMBER=${{ github.run_number }} |