Skip to content

Fixed workflow for publish artifacts #1851

Fixed workflow for publish artifacts

Fixed workflow for publish artifacts #1851

Workflow file for this run

name: cicd
on:
push:
# branches: [main]
pull_request:
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
# test_novus_100g:
# runs-on: [snappi-ixn-ci-novus100g]
# steps:
# - name: Checkout source
# uses: actions/checkout@v2
# with:
# ref: ${{ env.BASE_BRANCH }}
# # ref: ${{ github.head_ref }}
# submodules: recursive
# - name: Set python path
# id: path
# run: echo "::set-output name=pythonv::/home/github-runner/pyenv/.env/bin/python"
# - name: Install dependencies
# run: |
# rm -rf .env
# ${{steps.path.outputs.pythonv}} do.py setup
# ${{steps.path.outputs.pythonv}} do.py init
# - name: Build distribution
# run: |
# ${{steps.path.outputs.pythonv}} do.py dist
# - name: Install package on clean env
# run: |
# rm -rf .env
# ${{steps.path.outputs.pythonv}} do.py setup
# ${{steps.path.outputs.pythonv}} do.py install
# ${{steps.path.outputs.pythonv}} do.py init
# - name: Run tests
# run: |
# TEST_USERNAME=${{secrets.TEST_USERNAME}} TEST_PASSWORD='${{secrets.TEST_PASSWORD}}' ${{steps.path.outputs.pythonv}} do.py test
test_novus_10g:
runs-on: [snappi-ixn-ci-novus10g]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_BRANCH }}
# ref: ${{ github.head_ref }}
submodules: recursive
- name: Set python path
id: path
run: echo "::set-output name=pythonv::/home/github-runner/pyenv/.env/bin/python"
- name: Install dependencies
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py init
- name: Build distribution
run: |
${{steps.path.outputs.pythonv}} do.py dist
- name: Install package on clean env
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py install
${{steps.path.outputs.pythonv}} do.py init
- name: Run tests
run: |
TEST_USERNAME=${{secrets.TEST_USERNAME}} ${{steps.path.outputs.pythonv}} do.py test novus10g
publish_artifacts:
# runs-on: [snappi-ixn-ci-novus100g]
runs-on: [snappi-ixn-ci-novus10g]
needs: [test_novus_10g]
# needs: [test_novus_100g, test_novus_10g]
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_BRANCH }}
# ref: ${{ github.head_ref }}
submodules: recursive
- name: Set python path
id: path
run: echo "::set-output name=pythonv::/home/github-runner/pyenv/.env/bin/python"
- name: Install dependencies
run: |
rm -rf .env
${{steps.path.outputs.pythonv}} do.py setup
${{steps.path.outputs.pythonv}} do.py init
- name: Build distribution
run: |
${{steps.path.outputs.pythonv}} do.py dist
- name: Get package version
id: get_version
run: |
echo "::set-output name=version::v$(${{steps.path.outputs.pythonv}} do.py version)"
- name: Check tag for current version
uses: mukunku/[email protected]
id: check_tag
with:
tag: ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
id: release
if: steps.check_tag.outputs.exists == 'false' && matrix.python-version == 'python38'
run: |
export RELEASE_FLAG=1
echo "::set-output name=release_flag::${RELEASE_FLAG}"
PYPI_USERNAME=${{ secrets.PYPI_USERNAME }} PYPI_PASSWORD=${{ secrets.PYPI_PASSWORD }} ${{steps.path.outputs.pythonv}} do.py release
- name: Create release and publish artifacts
if: steps.check_tag.outputs.exists == 'false' && matrix.python-version == 'python38'
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
tag: ${{ steps.get_version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts if release didn't happen
if: steps.check_tag.outputs.exists == 'true'
uses: actions/upload-artifact@v3
with:
path: dist
- name: Set the release version/workflow id
run: |
${{steps.path.outputs.pythonv}} do.py install_requests ${{steps.path.outputs.pythonv}}
${{steps.path.outputs.pythonv}} do.py check_release_flag ${{ steps.release.outputs.release_flag }} ${{ steps.get_version.outputs.version }}
# cicd_snappitest:
# runs-on: [snappi-ixn-ci-novus100g]
# needs: test_novus_100g
# steps:
# - name: Trigger CI/CD snappi-tests
# run: |
# git clone https://github.com/open-traffic-generator/snappi-tests.git
# mv version.txt snappi-tests
# cd snappi-tests
# git add version.txt
# git commit --allow-empty -m "Trigger Snappi test from snappi-ixnetwork"
# git remote set-url origin https://${{secrets.CI_TOKEN}}@github.com/open-traffic-generator/snappi-tests.git
# git push origin main