Skip to content

Commit cbea8fc

Browse files
committed
feature/workflow_dispatch to test contributors code
1 parent fa6b69c commit cbea8fc

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Python Package - Contributor
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-20.04
9+
strategy:
10+
matrix:
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Display Python version
19+
run: python -c "import sys; print(sys.version)"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r test_requirements.txt
24+
- name: Test with pytest
25+
run: |
26+
pytest --cov=./ --cov-report=xml
27+
28+
notify:
29+
needs: test
30+
runs-on: ubuntu-20.04
31+
if: contains(fromJson('["refs/heads/main", "refs/heads/binaries-fixes"]'), github.ref) || startsWith(github.ref, 'refs/tags')
32+
steps:
33+
- name: Slack trigger
34+
uses: slackapi/[email protected]
35+
env:
36+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
37+
38+
build-binaries:
39+
needs: test
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
matrix:
43+
os: ['windows-latest', 'ubuntu-20.04', 'macos-latest']
44+
env:
45+
BINARY_OS: '${{ matrix.os }}'
46+
steps:
47+
- uses: actions/checkout@v3
48+
- name: Set up Python
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version: '3.10'
52+
- name: Install Dependencies
53+
run: python binaries.py install
54+
- name: Test Safety
55+
run: python binaries.py test
56+
- name: Producing Binaries
57+
run: python binaries.py dist
58+
- uses: actions/upload-artifact@v3
59+
if: ${{ matrix.os == 'windows-latest' }}
60+
with:
61+
name: safety-win-i686.exe
62+
path: dist/safety-win-i686.exe
63+
if-no-files-found: error
64+
- uses: actions/upload-artifact@v3
65+
if: ${{ matrix.os == 'windows-latest' }}
66+
with:
67+
name: safety-win-x86_64.exe
68+
path: dist/safety-win-x86_64.exe
69+
if-no-files-found: error
70+
- uses: actions/upload-artifact@v3
71+
if: ${{ matrix.os == 'ubuntu-20.04' }}
72+
with:
73+
name: safety-linux-x86_64
74+
path: dist/safety-linux-x86_64
75+
if-no-files-found: error
76+
- uses: actions/upload-artifact@v3
77+
if: ${{ matrix.os == 'macos-latest' }}
78+
with:
79+
name: safety-macos-x86_64
80+
path: dist/safety-macos-x86_64
81+
if-no-files-found: error

0 commit comments

Comments
 (0)