fix(CI): Fixed poetry deprecated plugin. Manual installation required. #311
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: "UnitTests and Build Docker Dev. Image" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
paths: | |
- "nuvla/**" | |
- "tests/**" | |
- "scripts/**" | |
- ".github/workflows/devel.yml" | |
- "pyproject.toml" | |
- "poetry.lock" | |
- "Dockerfile" | |
workflow_dispatch: | |
jobs: | |
run-unittests: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-0 # increment to reset cache | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Ensure export plugin | |
run: | | |
poetry self add poetry-plugin-export | |
- name: Generate server requirements | |
run: | | |
mkdir -p dist | |
poetry export -f requirements.txt -o requirements.test.txt --without-hashes --without-urls --with server --with test | |
- name: Install TOX | |
run: | | |
pip install tox | |
- name: Run Unittests | |
id: unittests-run | |
run: | | |
tox | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: test-report.xml | |
# - name: SonarCloud Scan | |
# uses: SonarSource/sonarcloud-github-action@master | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
build-package: | |
needs: run-unittests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-0 # increment to reset cache | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Ensure export plugin | |
run: | | |
poetry self add poetry-plugin-export | |
- name: Generate server requirements | |
run: | | |
mkdir -p dist | |
poetry export -f requirements.txt -o dist/requirements.txt --without-hashes --without-urls --with server | |
- name: Build Package | |
run: | | |
poetry build --format=wheel --no-interaction | |
cp ./dist/*.whl ./dist/nuvla_job_engine-latest-py3-none-any.whl | |
- name: Save wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: freeze | |
path: dist/ | |
build-job-engine: | |
needs: build-package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set env | |
shell: bash | |
run: echo "BUILD_TIME=$(date --utc +%FT%T.%3NZ)" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: freeze | |
path: dist/ | |
- name: SetUp QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.SIXSQ_DOCKER_USERNAME }} | |
password: ${{ secrets.SIXSQ_DOCKER_PASSWORD }} | |
- name: Extract branch name and substitute slashes | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | tr '/' '-' >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
build-args: | | |
GIT_BRANCH=${{ github.head_ref || github.ref_name }} | |
GIT_BUILD_TIME=${{ env.BUILD_TIME }} | |
GIT_COMMIT_ID=${{ github.sha }} | |
GITHUB_RUN_NUMBER=${{ github.run_number }} | |
GITHUB_RUN_ID=${{ github.run_id }} | |
PROJECT_URL=${{ github.server_url }}/${{ github.repository }} | |
PACKAGE_NAME=${{ env.PACKAGE_NAME }} | |
PACKAGE_TAG=latest | |
push: true | |
tags: > | |
nuvladev/job:${{ steps.extract_branch.outputs.branch }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |