This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
97 lines (81 loc) · 3.05 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
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build_and_release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: ImpartusScraper.exe
asset_name: impartus-scraper-windows.exe
# disabled because it's very finicky
# - os: ubuntu-18.04
# artifact_name: ImpartusScraper
# asset_name: impartus-scraper-linux
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Poetry
uses: Gr1N/setup-poetry@v4
- name: Get poetry cache dir
id: poetry-cache-dir
run: echo "::set-output name=dir::$(poetry config cache-dir)"
- name: Cache Poetry virtualenv
id: poetry-cache
uses: actions/cache@v2
with:
path: ${{ steps.poetry-cache-dir.outputs.dir }}
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install deps win
if: runner.os == 'Windows' && steps.poetry-cache.outputs.cache-hit != 'true'
run: |
# Download and extract FFmpeg, needs to be in PATH.
# Copy it to poetry dir so that it can be cached
# TODO: Compile ffmpeg manually to save space
iwr https://github.com/ShareX/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win64.zip -OutFile ffmpeg.zip
Expand-Archive ffmpeg.zip -DestinationPath ${{ steps.poetry-cache-dir.outputs.dir }}
- if: runner.os == 'Windows'
run: echo ${{ steps.poetry-cache-dir.outputs.dir }} | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install deps ubuntu
if: runner.os == 'Linux'
run: |
# TODO: Compile ffmpeg manually to save space
sudo apt update
sudo apt install -y ffmpeg pkg-config upx libgtk-3-dev
echo "ILC_SCRAPER_UPX=1" >> $GITHUB_ENV
- name: Pre setup venv
if: runner.os == 'Linux' && steps.poetry-cache.outputs.cache-hit != 'true'
run: |
# manually add wxpython wheel
wx_ver=$(poetry show wxpython | awk '/^version/ {print $3}');
poetry run pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }} "wxPython==$wx_ver";
- name: Install python deps
if: steps.poetry-cache.outputs.cache-hit != 'true'
run: poetry install -E gui
- name: Build file using pyinstaller
run: poetry run pyinstaller build.spec
- name: Upload to artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.asset_name }}
path: dist/${{ matrix.artifact_name }}
- name: Upload to release
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}