-
-
Notifications
You must be signed in to change notification settings - Fork 44
158 lines (131 loc) · 5.43 KB
/
build_pr.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
name: Pull Request build check
on:
pull_request:
paths:
- '**.py'
- 'requirements.txt'
- 'requirements-optional.txt'
- 'docs/*'
env:
TEST_TAG: mansuf/mangadex-downloader:test
TEST_OPTIONAL_TAG: mansuf/mangadex-downloader:test-optional
LATEST_TAG: mansuf/mangadex-downloader:latest
LATEST_OPTIONAL_TAG: mansuf/mangadex-downloader:latest-optional
jobs:
docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
- name: Build and export to Docker (with optional dependencies)
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.optional
load: true
tags: ${{ env.TEST_OPTIONAL_TAG }}
- name: Test docker image
run: |
docker run --rm ${{ env.TEST_TAG }}
- name: Test
run: |
docker run --rm ${{ env.TEST_OPTIONAL_TAG }}
windows-build:
name: Build app & docs (Windows)
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Setup python (x64)
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Setup python (x86)
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x86
- name: Install required libraries
run: |
py -${{ matrix.python-version }}-64 -m pip install -U pip
py -${{ matrix.python-version }}-64 -m pip install -U wheel pyinstaller setuptools
py -${{ matrix.python-version }}-64 -m pip install -U .[optional]
py -${{ matrix.python-version }}-64 -m pip install -U .[docs]
py -${{ matrix.python-version }}-32 -m pip install -U pip
py -${{ matrix.python-version }}-32 -m pip install -U wheel pyinstaller setuptools
py -${{ matrix.python-version }}-32 -m pip install -U .[optional]
py -${{ matrix.python-version }}-32 -m pip install -U .[docs]
- name: Test imports
run: |
# I..... have no idea for this
mangadex-dl --version
- name: Get python version
run: |
$PythonVersion = (python --version)
Write-Output "python_version=${PythonVersion}" | Out-File -FilePath $env:GITHUB_ENV -Append
# Build mangadex-downloader with PyInstaller
# only allow python 3.10
- name: Compile script
if: ${{ contains(env.python_version, '3.10') }}
run: |
py -${{ matrix.python-version }}-64 -m PyInstaller "mangadex-dl_x64.spec" --distpath "./dist_x64"
py -${{ matrix.python-version }}-32 -m PyInstaller "mangadex-dl_x86.spec" --distpath "./dist_x86"
- name: Run compiled script
if: ${{ contains(env.python_version, '3.10') }}
run: |
& ".\dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" --version
& ".\dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" --version
- name: Cleanup build
if: contains(env.python_version, '3.10')
run: |
# x86 executable
copy "LICENSE" "dist_x86\mangadex-dl_x86"
copy "README.md" "dist_x86\mangadex-dl_x86"
copy "docs\changelog.md" "dist_x86\mangadex-dl_x86"
echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x86\mangadex-dl_x86\update.bat"
echo "start cmd" | Out-File -FilePath "dist_x86\mangadex-dl_x86\start cmd.bat"
Rename-Item -Path "dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" -NewName "mangadex-dl.exe"
Rename-Item -Path "dist_x86\mangadex-dl_x86" -NewName "mangadex-dl"
Compress-Archive -Path "dist_x86\mangadex-dl" -DestinationPath "mangadex-dl_x86.zip"
# x64 executable
copy "LICENSE" "dist_x64\mangadex-dl_x64"
copy "README.md" "dist_x64\mangadex-dl_x64"
copy "docs\changelog.md" "dist_x64\mangadex-dl_x64"
echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x64\mangadex-dl_x64\update.bat"
echo "start cmd" | Out-File -FilePath "dist_x64\mangadex-dl_x64\start cmd.bat"
Rename-Item -Path "dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" -NewName "mangadex-dl.exe"
Rename-Item -Path "dist_x64\mangadex-dl_x64" -NewName "mangadex-dl"
Compress-Archive -Path "dist_x64\mangadex-dl" -DestinationPath "mangadex-dl_x64.zip"
- name: Upload artifact (x64)
if: contains(env.python_version, '3.10')
uses: actions/upload-artifact@v3
with:
name: mangadex-dl_x64
path: dist_x64/mangadex-dl/
- name: Upload artifact (x86)
if: contains(env.python_version, '3.10')
uses: actions/upload-artifact@v3
with:
name: mangadex-dl_x86
path: dist_x86/mangadex-dl/
# Only build docs in Python 3.10
- name: Build docs
if: contains(env.python_version, '3.10')
run: |
cd docs
sphinx-build -M "html" "." "_build"