Skip to content

Commit

Permalink
Merge pull request #53 from nuvlaedge/tasklist_issue_3335
Browse files Browse the repository at this point in the history
feat: Add containerised version of the validator
  • Loading branch information
ignacio-penas authored Oct 21, 2024
2 parents a2b27b3 + 8371ddf commit 01232f1
Show file tree
Hide file tree
Showing 13 changed files with 638 additions and 493 deletions.
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.3.18"
}
40 changes: 40 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"release-type": "python",
"include-v-in-tag": false,
"changelog-sections": [
{ "type": "feat", "section": "Features" },
{ "type": "feature", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "revert", "section": "Reverts" },
{ "type": "deps", "section": "Dependencies","hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": false }
],
"packages": {
".": {
"release-type": "python",
"include-v-in-tag": false,
"changelog-sections": [
{ "type": "feat", "section": "Features" },
{ "type": "feature", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements", "hidden": false},
{ "type": "revert", "section": "Reverts" },
{ "type": "deps", "section": "Dependencies","hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": false }
]
}
}
}
14 changes: 0 additions & 14 deletions .github/release.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .github/workflows/bump-version.yml

This file was deleted.

110 changes: 110 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: "Release Please"

on:
push:
branches:
- main
- release/*

jobs:
trigger-release:
runs-on: ubuntu-latest
needs: run-validator
outputs:
release_created: ${{ steps.release.outputs.release_created }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
tag_name: ${{ steps.release.outputs.tag_name }}

steps:
- id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
target-branch: ${{ github.ref_name }}
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json

build-wheel:
runs-on: ubuntu-latest
needs: trigger-release
if: needs.trigger-release.outputs.release_created

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: SetUp python interpreter
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Load cached poetry
uses: actions/cache@v4
with:
path: ~/.local
key: dotlocal-${{ runner.os }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Build library
run: |
poetry build --no-interaction --format=wheel
- name: Upload wheel
run: |
echo "Uploading wheel to release ${{ needs.trigger-release.outputs.tag_name }}"
gh release upload ${{ needs.trigger-release.outputs.tag_name }} dist/*.whl
build-image:
runs-on: ubuntu-latest
needs: trigger-release
if: needs.trigger-release.outputs.release_created

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# ------------------------------------------------
# Setup Docker ad Qemu
# ------------------------------------------------
- name: SetUp QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: >
nuvladev/${{ github.event.repository.name }}:latest,
nuvladev/${{ github.event.repository.name }}:${{ needs.trigger-release.outputs.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

61 changes: 0 additions & 61 deletions .github/workflows/release.yml

This file was deleted.

Empty file added CHANGELOG.md
Empty file.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG ALPINE_MAJ_MIN_VERSION="3.20"
ARG PYTHON_MAJ_MIN_VERSION="3.12"

ARG BASE_IMAGE=python:${PYTHON_MAJ_MIN_VERSION}-alpine${ALPINE_MAJ_MIN_VERSION}

# ------------------------------------------------------------------------
FROM ${BASE_IMAGE} AS poetry-image

RUN pip install poetry

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR /app

COPY --link poetry.lock pyproject.toml README.md /app/

RUN poetry install --no-root && rm -rf /tmp/poetry_cache


FROM ${BASE_IMAGE} AS runtime

ENV VIRTUAL_ENV=/app/.venv PATH="/app/.venv/bin:$PATH"

COPY --from=poetry-image ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY --link validation_framework/ ./validation_framework
COPY --link conf/targets ./conf/targets

ENTRYPOINT ["python", "-m", "validation_framework"]
Loading

0 comments on commit 01232f1

Please sign in to comment.