-
Notifications
You must be signed in to change notification settings - Fork 22
164 lines (159 loc) · 5.12 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Run Tests and Build Quit Store Releases
on: [push]
jobs:
test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python: [3.7, 3.8, 3.9, '3.10', '3.11']
# include:
# - python: "3.11.0-rc.1"
# experimental: true
steps:
# Configures the python version
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Print Versions
run: |
python --version
git --version
- uses: actions/checkout@v3
- name: Install Required Packages
run: sudo apt-get install cmake libssl-dev libssh2-1-dev
- name: Install Python Dependencies
# pygit2 is installed separately to make sure cached-property is
# installed on python 3.7: https://github.com/libgit2/pygit2/issues/1114
run: |
pip install -U poetry
poetry run pip install pygit2
poetry install --no-root
- name: Check Conding style
run: poetry run pylama -i E402,C
- name: Set Git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Quit CI Tests"
- name: Run Tests
run: |
poetry run pytest --cov=quit --cov-report=term-missing
- name: Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
poetry run coveralls
build:
runs-on: ubuntu-22.04
needs: test
strategy:
matrix:
python-version: [3.9]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pyinstaller
run: |
# Update pip
python -m pip install --progress-bar=off poetry
# Install dependencies
poetry install
# Build wheel and source package
poetry build
- name: Upload Wheel and Source
uses: actions/upload-artifact@v3
with:
name: wheel-and-source
path: |
dist/quit-*.whl
dist/quit-*.tar.gz
release:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
python-version: [3.9]
os: ['windows-2022', 'ubuntu-22.04', 'macos-12']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#- name: Patch Windows requirements
# if: startsWith(matrix.os, 'windows')
# run: |
# git apply requirements.txt.windows.patch
- name: Pyinstaller
run: |
# Update pip
python -m pip install --progress-bar=off poetry
# Install dependencies
poetry install
# Run PyInstaller
poetry run pyinstaller quit.spec
- name: Rename Lin Release
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: cp ./dist/run ./dist/quit-linux
- name: Rename Mac Release
if: ${{ startsWith(matrix.os, 'macos') }}
run: cp ./dist/run ./dist/quit-macos
- name: Rename Win Release
if: ${{ startsWith(matrix.os, 'windows') }}
run: cp ./dist/run.exe ./dist/quit-windows.exe
- name: Upload Binary Releases 🚀
uses: actions/upload-artifact@v3
with:
name: binary-releases
path: |
dist/quit-windows.exe
dist/quit-linux
dist/quit-macos
docker:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: wheel-and-source
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
aksw/quitstore
ghcr.io/aksw/quitstore
- name: Build and push for many architectures
id: docker_build_tagged
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
platforms: 'linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le'
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-contexts: dist=./dist