1- name : Pull Request Tests
2- on : pull_request
1+ name : Test Checks
2+ on :
3+ push :
4+ branches :
5+ - main
6+ - ' release/*'
7+ pull_request :
8+ branches :
9+ - main
10+ - ' release/*'
311
412jobs :
5- diff-check :
13+ test-setup :
614 runs-on : ubuntu-18.04
715 outputs :
16+ branch : ${{ steps.get-branch.outputs.branch }}
817 base : ${{ steps.base-check.outputs.output }}
918 deepsparse : ${{ steps.deepsparse-check.outputs.output }}
1019 keras : ${{ steps.keras-check.outputs.output }}
@@ -15,46 +24,60 @@ jobs:
1524 - uses : actions/checkout@v2
1625 with :
1726 fetch-depth : 0
27+ - run : git branch --show-current
28+ - name : Get current branch
29+ id : get-branch
30+ run : >
31+ (git branch --show-current | grep -E "release/")
32+ && echo "::set-output name=branch::$(git branch --show-current)"
33+ || echo "::set-output name=branch::main"
1834 - name : " Checking if sparseml was changed"
1935 id : base-check
2036 run : >
21- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml|setup.py")
37+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml|setup.py")
38+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
2239 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
2340 - name : " Checking if sparseml.deepsaprse was changed"
2441 id : deepsparse-check
2542 run : >
26- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/deepsparse|setup.py")
43+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/deepsparse|setup.py")
44+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
2745 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
2846 - name : " Checking if sparseml.keras was changed"
2947 id : keras-check
3048 run : >
31- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/keras|setup.py")
49+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/keras|setup.py")
50+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
3251 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
3352 - name : " Checking if sparseml.onnx was changed"
3453 id : onnx-check
3554 run : >
36- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/onnx|setup.py")
55+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/onnx|setup.py")
56+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
3757 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
3858 - name : " Checking if sparseml.pytorch was changed"
3959 id : pytorch-check
4060 run : >
41- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/pytorch|setup.py")
61+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/pytorch|setup.py")
62+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
4263 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
4364 - name : " Checking if sparseml.tensorflow_v1 was changed"
4465 id : tensorflow_v1-check
4566 run : >
46- (git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/tensorflow_v1|setup.py")
67+ ((git diff --name-only origin/main HEAD | grep -E "[src|tests]/sparseml/tensorflow_v1|setup.py")
68+ || (echo $GITHUB_REF | grep -E "refs/heads/[release/|main]"))
4769 && echo "::set-output name=output::1" || echo "::set-output name=output::0"
4870 base-tests :
4971 runs-on : ubuntu-18.04
50- needs : diff-check
51- if : ${{needs.diff-check .outputs.base == 1}}
72+ needs : test-setup
73+ if : ${{needs.test-setup .outputs.base == 1}}
5274 steps :
5375 - uses : actions/checkout@v2
5476 - uses : actions/checkout@v2
5577 with :
5678 repository : " neuralmagic/sparsezoo"
5779 path : " sparsezoo"
80+ ref : ${{needs.test-setup.outputs.branch}}
5881 - name : " ⚙️ Install sparsezoo dependencies"
5982 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
6083 - name : " Clean sparsezoo directory"
@@ -65,14 +88,15 @@ jobs:
6588 run : make test
6689 deepsparse-tests :
6790 runs-on : ubuntu-18.04
68- needs : diff-check
69- if : ${{needs.diff-check .outputs.deepsparse == 1}}
91+ needs : test-setup
92+ if : ${{needs.test-setup .outputs.deepsparse == 1}}
7093 steps :
7194 - uses : actions/checkout@v2
7295 - uses : actions/checkout@v2
7396 with :
7497 repository : " neuralmagic/sparsezoo"
7598 path : " sparsezoo"
99+ ref : ${{needs.test-setup.outputs.branch}}
76100 - name : " ⚙️ Install sparsezoo dependencies"
77101 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
78102 - name : " Clean sparsezoo directory"
@@ -83,14 +107,15 @@ jobs:
83107 run : make test TARGETS=deepsparse
84108 keras-tests :
85109 runs-on : ubuntu-18.04
86- needs : diff-check
87- if : ${{needs.diff-check .outputs.keras == 1}}
110+ needs : test-setup
111+ if : ${{needs.test-setup .outputs.keras == 1}}
88112 steps :
89113 - uses : actions/checkout@v2
90114 - uses : actions/checkout@v2
91115 with :
92116 repository : " neuralmagic/sparsezoo"
93117 path : " sparsezoo"
118+ ref : ${{needs.test-setup.outputs.branch}}
94119 - name : " ⚙️ Install sparsezoo dependencies"
95120 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
96121 - name : " Clean sparsezoo directory"
@@ -101,14 +126,15 @@ jobs:
101126 run : make test TARGETS=keras
102127 onnx-tests :
103128 runs-on : ubuntu-18.04
104- needs : diff-check
105- if : ${{needs.diff-check .outputs.onnx == 1}}
129+ needs : test-setup
130+ if : ${{needs.test-setup .outputs.onnx == 1}}
106131 steps :
107132 - uses : actions/checkout@v2
108133 - uses : actions/checkout@v2
109134 with :
110135 repository : " neuralmagic/sparsezoo"
111136 path : " sparsezoo"
137+ ref : ${{needs.test-setup.outputs.branch}}
112138 - name : " ⚙️ Install sparsezoo dependencies"
113139 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
114140 - name : " Clean sparsezoo directory"
@@ -119,14 +145,15 @@ jobs:
119145 run : make test TARGETS=onnx
120146 pytorch-tests :
121147 runs-on : ubuntu-18.04
122- needs : diff-check
123- if : ${{needs.diff-check .outputs.pytorch == 1}}
148+ needs : test-setup
149+ if : ${{needs.test-setup .outputs.pytorch == 1}}
124150 steps :
125151 - uses : actions/checkout@v2
126152 - uses : actions/checkout@v2
127153 with :
128154 repository : " neuralmagic/sparsezoo"
129155 path : " sparsezoo"
156+ ref : ${{needs.test-setup.outputs.branch}}
130157 - name : " ⚙️ Install sparsezoo dependencies"
131158 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
132159 - name : " Clean sparsezoo directory"
@@ -137,14 +164,15 @@ jobs:
137164 run : make test TARGETS=pytorch
138165 tensorflow-v1-tests :
139166 runs-on : ubuntu-18.04
140- needs : diff-check
141- if : ${{needs.diff-check .outputs.tensorflow_v1 == 1}}
167+ needs : test-setup
168+ if : ${{needs.test-setup .outputs.tensorflow_v1 == 1}}
142169 steps :
143170 - uses : actions/checkout@v2
144171 - uses : actions/checkout@v2
145172 with :
146173 repository : " neuralmagic/sparsezoo"
147174 path : " sparsezoo"
175+ ref : ${{needs.test-setup.outputs.branch}}
148176 - name : " ⚙️ Install sparsezoo dependencies"
149177 run : pip3 install -U pip && pip3 install setuptools sparsezoo/
150178 - name : " Clean sparsezoo directory"
0 commit comments