Skip to content

Commit ae23131

Browse files
authored
Merge pull request #12 from seiya-dev/github-actions
submodules updater and test builds
2 parents f6efda0 + 504011f commit ae23131

8 files changed

Lines changed: 549 additions & 349 deletions

File tree

.github/workflows/check-smp.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Update data
2+
on:
3+
push:
4+
branches:
5+
- main
6+
schedule:
7+
- cron: '0 5 * * *'
8+
workflow_dispatch: #
9+
10+
env:
11+
submodule_owner: ShiftMediaProject
12+
submodule_folder: SMP
13+
14+
jobs:
15+
check_smp:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
submodule:
20+
- fontconfig
21+
- freetype2
22+
- fribidi
23+
- harfbuzz
24+
- libass
25+
- libiconv
26+
- liblzma
27+
- libxml2
28+
- zlib
29+
steps:
30+
- name: Git checkout
31+
uses: actions/checkout@v3
32+
with:
33+
ref: master
34+
- name: Set submodule current
35+
run: |
36+
git submodule update --init --recursive "${{ env.submodule_folder }}/${{ matrix.submodule }}"
37+
cd ${{ env.submodule_folder }}/${{ matrix.submodule }}
38+
echo SUBMODULE_NAME=${{ matrix.submodule }} >> $GITHUB_ENV
39+
echo SUBMODULE_REV=$(git describe --tags --first-parent --abbrev=7 --long --dirty) >> $GITHUB_ENV
40+
echo SUBMODULE_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV
41+
- name: Get submodule current remote
42+
id: current
43+
uses: cardinalby/git-get-release-action@1.2.2
44+
env:
45+
GITHUB_TOKEN: ${{ github.token }}
46+
with:
47+
repo: ${{ env.submodule_owner }}/${{ matrix.submodule }}
48+
commitSha: ${{ env.SUBMODULE_SHA }}
49+
doNotFailIfNotFound: true
50+
- name: Get submodule latest remote
51+
id: latest
52+
uses: cardinalby/git-get-release-action@1.2.2
53+
env:
54+
GITHUB_TOKEN: ${{ github.token }}
55+
with:
56+
repo: ${{ env.submodule_owner }}/${{ matrix.submodule }}
57+
latest: true
58+
prerelease: false
59+
doNotFailIfNotFound: true
60+
- name: Set submodule current remote
61+
if: steps.current.outputs.tag_name != ''
62+
run: echo SUBMODULE_REV=${{ steps.current.outputs.tag_name }} >> $GITHUB_ENV
63+
- name: Check if need update
64+
if: |
65+
steps.latest.outputs.tag_name != '' &&
66+
steps.current.outputs.tag_name == '' ||
67+
steps.latest.outputs.tag_name != '' &&
68+
steps.current.outputs.tag_name != steps.latest.outputs.tag_name
69+
run: |
70+
cd ${{ env.submodule_folder }}/${{ matrix.submodule }}
71+
git checkout ${{ steps.latest.outputs.tag_name }}
72+
echo NEED_UPDATE=1 >> $GITHUB_ENV
73+
- name: Run update
74+
if: ${{ env.NEED_UPDATE }} == '1'
75+
uses: peter-evans/create-pull-request@v4
76+
with:
77+
commit-message: Update ${{ matrix.submodule }} to ${{ steps.latest.outputs.tag_name }}
78+
branch: submodule-${{ matrix.submodule }}-${{ steps.latest.outputs.tag_name }}
79+
base: master
80+
delete-branch: true
81+
title: Update ${{ matrix.submodule }} to ${{ steps.latest.outputs.tag_name }}
82+
body: |
83+
Update ${{ matrix.submodule }} to ${{ steps.latest.outputs.tag_name }}
84+
Current: ${{ env.SUBMODULE_REV }}

.github/workflows/github-ci.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: GitHub CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch: #
7+
8+
jobs:
9+
build-linux:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Git checkout
13+
uses: actions/checkout@v3
14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install cmake git ninja-build checkinstall
18+
sudo apt-get install -y --no-install-recommends build-essential g++ gcc libass-dev pkg-config
19+
git clone https://github.com/AviSynth/AviSynthPlus avsplus
20+
cd avsplus
21+
cmake -G "Ninja" -B avisynth-build -S .
22+
cd avisynth-build
23+
ninja
24+
sudo checkinstall --pkgname=avisynth --pkgversion="$(grep -r Version avs_core/avisynth.pc | cut -f2 -d " ")-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes --addso=yes --fstrans=no --default ninja install
25+
- name: Build binary
26+
run: |
27+
cmake -B build -S .
28+
cmake --build build --clean-first
29+
- name: Copy binary
30+
run: cmake -E copy "build/src/libassrender.so" "dist/libassrender.so"
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v2
33+
with:
34+
name: assrender_bin_linux
35+
path: dist
36+
37+
build-win:
38+
runs-on: windows-2019
39+
steps:
40+
- name: Git checkout
41+
uses: actions/checkout@v3
42+
- name: Install dependencies
43+
run: |
44+
git submodule update --init --recursive
45+
git clone https://github.com/ShiftMediaProject/VSYASM.git
46+
.\VSYASM\install_script.bat
47+
git clone https://github.com/ShiftMediaProject/VSNASM.git
48+
.\VSNASM\install_script.bat
49+
md avsplus
50+
# - name: Install MSYS2 with dependencies
51+
# uses: msys2/setup-msys2@v2
52+
# with:
53+
# update: true
54+
# install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libass
55+
# msystem: MINGW64
56+
# path-type: inherit
57+
- name: Parse AviSynth+ release metadata
58+
uses: actions/github-script@v6
59+
with:
60+
script: |
61+
const req = await github.request('https://api.github.com/repos/avisynth/avisynthplus/releases');
62+
const data = req.data;
63+
let link = '';
64+
for(let rel of data){
65+
if(rel.prerelease||rel.draft){
66+
continue;
67+
}
68+
for(let asset of rel.assets){
69+
if(asset.name.match(/-filesonly.7z$/i)){
70+
link = asset.browser_download_url;
71+
}
72+
}
73+
if(link != ''){
74+
break;
75+
}
76+
}
77+
core.exportVariable('PACKAGE_URL', link);
78+
- name: Download AviSynth+ latest release
79+
run: curl -L "${{ env.PACKAGE_URL }}" -o "./avsplus/avisynthplus-latest-filesonly.7z"
80+
- name: Move libs files
81+
run: |
82+
7z e "avsplus\*-filesonly.7z" -o"lib\x86-32" "*\x86\c_api\AviSynth.lib"
83+
7z e "avsplus\*-filesonly.7z" -o"lib\x86-64" "*\x64\c_api\AviSynth.lib"
84+
- name: Add MSBuild to PATH
85+
uses: microsoft/setup-msbuild@v1
86+
- name: Build x86 binary
87+
run: MSBuild.exe /t:Rebuild /p:PlatformToolset=v142 /m /p:Configuration=Release /p:Platform=x86
88+
- name: Build x64 binary
89+
run: MSBuild.exe /t:Rebuild /p:PlatformToolset=v142 /m /p:Configuration=Release /p:Platform=x64
90+
# - name: Build MINGW64 binary
91+
# shell: msys2 {0}
92+
# run: |
93+
# cmake -G "MinGW Makefiles" -B build -S .
94+
# cmake --build build --config Release --clean-first
95+
- name: Copy x86 binary
96+
run: cmake -E copy "bin\Release_Win32\assrender.dll" "dist\Release_x86\assrender.dll"
97+
- name: Copy x64 binary
98+
run: cmake -E copy "bin\Release_x64\assrender.dll" "dist\Release_x64\assrender.dll"
99+
# - name: Copy MINGW64 binary
100+
# run: cmake -E copy "build\src\assrender.dll" "dist\Release_MINGW64\assrender.dll"
101+
- name: Upload artifact
102+
uses: actions/upload-artifact@v2
103+
with:
104+
name: assrender_bin_win
105+
path: dist

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ makefile
2121
#make
2222
install_manifest.txt
2323

24+
avsplus/
2425
SMP/
26+
VSNASM/
27+
VSYASM/
2528

2629
#*/build/.vs
2730
*/build/Win32
@@ -37,6 +40,7 @@ Test
3740
x64/
3841
x86/
3942
bld/
43+
[Bb]uild/
4044
[Bb]in/
4145
[Oo]bj/
4246
[Ll]og/

0 commit comments

Comments
 (0)