tar files before uploading, properly set execution bit, remove redundant file moving logic, split into windows and unix jobs

This commit is contained in:
Tim Yuen 2022-09-11 18:42:23 -04:00
parent 0443549277
commit be48eadbc6

View file

@ -5,30 +5,16 @@ on:
- v** - v**
workflow_dispatch: workflow_dispatch:
env:
dist-folder-path: dist/OpenSeeFace # The directory generated by PyInstaller
artifact-path: OpenSeeFace # Needed since upload-artifacts pulls files out of parent directories
jobs: jobs:
build-all: build-windows:
strategy: env:
fail-fast: false dist-path: dist/OpenSeeFace
matrix: runs-on: windows-latest
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps: steps:
- name: Pull OpenSeeFace - name: Pull OpenSeeFace
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Create binary Unix - name: Create binary
if: matrix.os != 'windows-latest'
shell: bash
run: |
chmod +x make_exe.sh
./make_exe.sh
- name: Create binary Windows
if: matrix.os == 'windows-latest'
shell: cmd shell: cmd
run: | run: |
choco install vcredist140 choco install vcredist140
@ -41,23 +27,59 @@ jobs:
make_exe.bat make_exe.bat
- name: Move files for uploading - name: Move files for uploading
shell: bash # Using bash for all OSs should be fine, even on Windows
run: |
mv dist/facetracker ${{ env.dist-folder-path }}
cp -r models ${{ env.dist-folder-path }}
mkdir ${{ env.artifact-path }}
mv ${{ env.dist-folder-path }} ${{ env.artifact-path }}
# Sometimes the executable bit doesn't get set for Unix builds for some reason
- name: Set executable bit
if: matrix.os != 'windows-latest'
shell: bash shell: bash
run: chmod +x ${{ env.artifact-path }}/* run: |
# Prevents the parent dist/ directory from being included
mv dist/facetracker ${{ env.dist-path }}
cp -r models ${{ env.dist-path }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: windows-latest
path: dist # Add the parent directory to prevent a tarbomb
if-no-files-found: error
# Files must be packed into a tar in order for file permissions to be preserved
build-unix:
env:
artifact-path: OpenSeeFace
tar-path: OpenSeeFace.tar
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Pull OpenSeeFace
uses: actions/checkout@v3
- name: Create binary
shell: bash
run: |
chmod +x make_exe.sh
./make_exe.sh
- name: Move files for uploading
shell: bash
run: |
# Prevents the parent dist/ directory from being included
mv dist/facetracker ${{ env.artifact-path }}
cp -r models ${{ env.artifact-path }}
- name: Fix permissions from PyInstaller
shell: bash
run: |
find ${{ env.artifact-path }} -type f -exec chmod -x {} +
chmod +x ${{ env.artifact-path }}/facetracker
- name: Pack files into tar
shell: bash
run: tar -cvf ${{ env.tar-path }} ${{ env.artifact-path }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.os }} name: ${{ matrix.os }}
path: ${{ env.artifact-path }} path: ${{ env.tar-path }}
if-no-files-found: error if-no-files-found: error