-
Notifications
You must be signed in to change notification settings - Fork 11
142 lines (136 loc) · 5.22 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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