Skip to content

Cisco Live 🤖🇳🇱 NSO services delivery #61

Cisco Live 🤖🇳🇱 NSO services delivery

Cisco Live 🤖🇳🇱 NSO services delivery #61

Workflow file for this run

name: Cisco Live 🤖🇳🇱 NSO services delivery
on:
push:
workflow_dispatch:
inputs:
run-tests:
description: '🤖 Run Robot tests'
required: false
default: 'yes'
type: choice
options:
- 'yes'
- 'no'
deliver-artifacts:
description: '📦 Generate artifacts'
required: false
default: 'yes'
type: choice
options:
- 'yes'
- 'no'
jobs:
set-workflow-options:
runs-on: self-hosted
outputs:
DELIVER_ARTIFACTS: ${{ steps.set-outputs.outputs.DELIVER_ARTIFACTS }}
RUN_TESTS: ${{ steps.set-outputs.outputs.RUN_TESTS }}
steps:
- name: Set output variables
id: set-outputs
run: |
echo "Setting variables ..."
echo "::set-output name=DELIVER_ARTIFACTS::${{ github.event.inputs.deliver-artifacts || 'yes' }}"
echo "::set-output name=RUN_TESTS::${{ github.event.inputs.run-tests || 'yes' }}"
build:
runs-on: self-hosted
needs: set-workflow-options
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: 🛠️ Build project
run: |
make run-nso-node
make load-neds
make load-packages
deliver-packages:
runs-on: self-hosted
needs: [set-workflow-options,build]
if: ${{ needs.set-workflow-options.outputs.DELIVER_ARTIFACTS == 'yes' }}
steps:
- name: 📦 Generate artifacts
run: |
make create-artifact-packages
- name: 📦 Upload services artifact
uses: actions/upload-artifact@v4
with:
name: ciscolive_demo_packages
path: pipeline/preconfigs/ciscolive_demo_packages.tar.gz
test:
runs-on: self-hosted
needs: [set-workflow-options,build]
if: ${{ needs.set-workflow-options.outputs.RUN_TESTS == 'yes' }}
steps:
- name: 🤖 Run tests
run: |
make prepare-test-network
make run-tests
deliver-tests:
runs-on: self-hosted
# if: ${{ env.RUN_TESTS == 'true' && env.DELIVER_ARTIFACTS == 'true' }}
needs: test
steps:
- name: 📦 Generate artifacts
run: |
make create-artifact-tests
- name: 📦 Upload tests artifact
uses: actions/upload-artifact@v4
with:
name: ciscolive_demo_tests
path: pipeline/preconfigs/ciscolive_demo_test.tar.gz
release:
runs-on: self-hosted
needs: [set-workflow-options,test]
if: github.ref == 'refs/heads/main' && needs.test.result == 'success' && needs.set-workflow-options.outputs.DELIVER_ARTIFACTS == 'yes'
steps:
- name: ⭐️ Get the latest tag
id: get_latest_tag
run: make get-current-release-tag
- name: ⭐️ Increment version
id: increment_version
run: make calculate-new-release-tag VERSION=${{ env.tag }}
- name: ⭐️ Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.new_version }}
release_name: Release v.${{ env.new_version }}
body: |
🏅 Automated NSO rfs packages code release v.${{ env.new_version }} 🏅
draft: false
prerelease: false
- name: ⭐️ Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pipeline/preconfigs/ciscolive_demo_packages.tar.gz
asset_name: ciscolive_demo_packages.tar.gz
asset_content_type: application/zip
cleanup:
runs-on: self-hosted
if: always()
needs: [build,deliver-packages,test,deliver-tests]
steps:
- name: 🧹 Cleanup resources
run: make clean