-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (108 loc) · 4.07 KB
/
main.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
name: Main
on:
- push
- pull_request
jobs:
test:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: ['ubuntu-22.04', 'macos-14', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python Dependencies
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Install Python Dependencies
shell: bash
run: pip3 install -r requirements.txt -r requirements-dev.txt
- name: Check Python Version Compatibility
shell: bash
run: vermin --no-tips --no-parse-comments --target=3.8- --violations sharkclipper
deploy:
if: github.ref == 'refs/heads/main'
needs: test
strategy:
matrix:
python-version: ['3.11']
os: ['ubuntu-22.04', 'macos-14', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Variables
id: vars
shell: bash
run: |
sha_short=$(git rev-parse --short HEAD)
base_version=$(grep version pyproject.toml | sed 's/^.*"\(.*\)"$/\1/')
bin_version=$(echo "${{ runner.os }}-${{ runner.arch }}-latest" | tr '[:upper:]' '[:lower:]')
echo "sha_short=${sha_short}" >> $GITHUB_OUTPUT
echo "base_version=${base_version}" >> $GITHUB_OUTPUT
echo "full_version=${base_version}-${sha_short}" >> $GITHUB_OUTPUT
echo "bin_version=${bin_version}" >> $GITHUB_OUTPUT
echo "bin_basename=shark-clipper-${bin_version}" >> $GITHUB_OUTPUT
- name: Write Version Override File
shell: bash
run: |
echo "${{ steps.vars.outputs.full_version }}" > VERSION.txt
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python Dependencies
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Install Python Dependencies
shell: bash
run: pip3 install -r requirements.txt -r requirements-dev.txt
- name: Fetch FFmpeg
shell: bash
run: ./scripts/fetch-ffmpeg.py
- name: Build ${{ runner.os }} Release Executable with Nuitka
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: sharkclipper/cli/server.py
standalone: true
onefile: true
output-file: '${{ steps.vars.outputs.bin_basename }}.bin'
include-data-dir: |
./static=static
include-data-files: |
./pyproject.toml=./
./VERSION.txt=./
./ffmpeg=./
./ffprobe=./
include-package: |
sharkclipper
- name: Set Windows Name
if: runner.os == 'Windows'
shell: bash
run: |
mv "build/${{ steps.vars.outputs.bin_basename }}.bin.exe" "build/${{ steps.vars.outputs.bin_basename }}.exe"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ steps.vars.outputs.bin_basename }}'
compression-level: 0
path: build/shark-clipper-*
- name: Release Latest
uses: softprops/action-gh-release@v2
with:
tag_name: latest-release
make_latest: true
files: build/shark-clipper-*
- name: Cleanup
shell: bash
run: rm -rf ffmpeg ffprobe build