commit #2070
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: cicd | |
on: | |
push: | |
pull_request: | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
test_novus_10g: | |
runs-on: [snappi-ixn-ci-novus10g] | |
steps: | |
- name: Set Timestamp | |
id: timestamp | |
run: echo "TIMESTAMP=$(TZ='Asia/Kolkata' date +"%D %T")" >> $GITHUB_ENV | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.BASE_BRANCH }} | |
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 | |
- name: Send Coverage Email | |
run: | | |
${{steps.path.outputs.pythonv}} do.py coverage | |
- name: Generate Allure report | |
run: | | |
source ~/.profile | |
${{steps.path.outputs.pythonv}} do.py generate_allure_report | |
- name: Deploy report to Github Pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v2 | |
env: | |
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PUBLISH_BRANCH: gh-pages | |
PUBLISH_DIR: allure-report | |
publish_artifacts: | |
runs-on: [snappi-ixn-ci-novus10g] | |
needs: [test_novus_10g] | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.BASE_BRANCH }} | |
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: github.ref == 'refs/heads/main' && steps.check_tag.outputs.exists == 'false' | |
run: | | |
export RELEASE_FLAG=1 | |
echo "::set-output name=release_flag::${RELEASE_FLAG}" | |
PYPI_USERNAME=__token__ PYPI_PASSWORD=${{ secrets.PYPI_API_TOKEN }} ${{steps.path.outputs.pythonv}} do.py release | |
- name: Create release and publish artifacts | |
if: github.ref == 'refs/heads/main' && steps.check_tag.outputs.exists == 'false' | |
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 | |