Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Test IPRoute automatic build #652

Test IPRoute automatic build

Test IPRoute automatic build #652

Workflow file for this run

name: "NuvlaEdge Component Build"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
tags-ignore:
- '*.*.*'
pull_request:
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-common-lib:
runs-on: ubuntu-latest
steps:
- name: Fetch nuvlaedge common
uses: actions/checkout@v3
with:
repository: nuvlaedge/nuvlaedge-common
- name: SetUp python interpreter
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Load cached poetry
uses: actions/cache@v2.1.6
with:
path: ~/.local
key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/main.yml') }}
- 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@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Build library
id: build
run: |
poetry build --no-interaction --format=wheel
- name: Save artifact
uses: actions/upload-artifact@v3
with:
name: nuvlaedge-common-lib
path: dist/nuvlaedge_common-*
tests:
needs: build-common-lib
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: SetUp python interpreter
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: pip
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: nuvlaedge-common-lib
- name: Install common library
run: |
pip install nuvlaedge_common-*
- name: Run unit tests
run: |
pip install -r code/requirements.tests.txt
pytest code/tests --junitxml=test-report.xml -v
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-report.xml
build:
# Run only if UnitTest succeed
needs: tests
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: SetUp QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
# if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm/v8,linux/arm64
build-args: |
GIT_BRANCH=${{ github.head_ref || github.ref_name }}
GIT_BUILD_TIME=$(date --utc +%FT%T.%3NZ)
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 }}
push: true
tags: >
nuvladev/${{ github.event.repository.name }}:${{ github.head_ref || github.ref_name }},
nuvladev/${{ github.event.repository.name }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
notify:
if: always()
name: Post Workflow Status To Slack
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Slack Workflow Notification
uses: Gamesight/slack-workflow-status@master
with:
# Required Input
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
# Optional Input
icon_emoji: ':ghost:'