This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (92 loc) · 2.99 KB
/
pull_requests.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
name: Build x64 Binaries
on:
pull_request:
branches:
- master
- releases/**
defaults:
run:
shell: bash
env:
project-name: qBitrr
jobs:
package:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python:
- '3.10'
os:
- windows-latest
- ubuntu-latest
arch:
- x64
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python}}
architecture: ${{ matrix.arch }}
- name: Install APT dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Get git hash
run: |
echo "Current Hash: $(git rev-parse --short HEAD)"
echo "::set-output name=HASH::$(git rev-parse --short HEAD)"
id: git_hash
- name: Set archive name
run: |
ARCHIVE_NAME=${{ env.project-name }}-${{ steps.git_hash.outputs.HASH }}-${{ matrix.os }}-${{ matrix.arch }}
echo "Archive name set to: $ARCHIVE_NAME"
echo "::set-output name=NAME::$ARCHIVE_NAME"
id: archieve
- name: Update git hash
run: |
sed -i -e 's/git_hash = \".*\"/git_hash = \"${{ steps.git_hash.outputs.HASH }}\"/g' ./qBitrr/bundled_data.py
- name: Retrieve current version
run: |
echo "Current version: $(python setup.py --version)"
echo "::set-output name=VERSION::$(python setup.py --version)"
id: current_version
- name: Install Python dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -r requirements.dev.txt
- name: Run PyInstaller
env:
PYTHONOPTIMIZE: 1 # Enable optimizations as if the -O flag is given.
PYTHONHASHSEED: 42 # Try to ensure deterministic results.
PYTHONUNBUFFERED: 1
run: |
pyinstaller build.spec
# This step exists for debugging. Such as checking if data files were included correctly by PyInstaller.
- name: List distribution files
run: |
find dist
# Archive the PyInstaller build using the appropriate tool for the platform.
- name: Tar files
if: runner.os != 'Windows'
run: |
tar --format=ustar -czvf ${{ steps.archieve.outputs.NAME }}.tar.gz dist/
- name: Archive files
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive dist/* ${{ steps.archieve.outputs.NAME }}.zip
# Upload archives as artifacts, these can be downloaded from the GitHub actions page.
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: automated-build-${{ steps.archieve.outputs.NAME }}
path: ${{ steps.archieve.outputs.NAME }}.*
if-no-files-found: error