-
Notifications
You must be signed in to change notification settings - Fork 109
121 lines (93 loc) · 3.15 KB
/
build.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
name: Build
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install wheel
pip install -r requirements.txt
- name: Run tests
run: pytest -s -rs
release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install packaging dependencies
run: pip install wheel
- name: Update version
run: sed -i 's/__version__ = "dev"/__version__ = "'"${GITHUB_REF##*/}"'"/g' lean/__init__.py
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
portable:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-latest]
python-version: ["3.10"]
# on a new tag (release), after 'test' and 'release' have ended we will run this
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [test, release]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Wait for pip release, sleep in seconds
run: sleep 900
shell: bash
- name: Setup Portable
run: pip install pyinstaller lean==${GITHUB_REF##*/}
shell: bash
- name: Create Portable
run: |
mkdir portable
cd portable
pyinstaller ../scripts/main.spec
shell: bash
- name: Zip package
if: matrix.os == 'windows-latest'
run: 7z a -tzip portable/dist/lean.${GITHUB_REF##*/}.${{ matrix.os }}.zip portable/dist/lean
shell: bash
- name: Zip package
if: matrix.os == 'macos-12' || matrix.os == 'ubuntu-22.04'
run: zip -r portable/dist/lean.${GITHUB_REF##*/}.${{ matrix.os }}.zip portable/dist/lean
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET }}
aws-region: us-west-1
- name: Publish To S3
run:
aws s3 cp portable/dist/lean.${GITHUB_REF##*/}.${{ matrix.os }}.zip s3://${{ secrets.AWS_BUCKET }}/${{ matrix.os }}/ --content-type "application/zip"
shell: bash
- name: Cleanup
run: |
rm -rf portable
shell: bash