refactor(iori): decouple ctrl-c handle #414
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Build | |
| on: [push] | |
| jobs: | |
| ffmpeg-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-pc-windows-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-apple-darwin | |
| os: macOS-latest | |
| - target: aarch64-apple-darwin | |
| os: macOS-latest | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| steps: | |
| - name: Setup | Checkout | |
| uses: actions/[email protected] | |
| # https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu | |
| - name: Setup | FFmpeg Build Tools [Linux] | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update -qq && sudo apt-get -y install \ | |
| autoconf \ | |
| automake \ | |
| build-essential \ | |
| cmake \ | |
| git-core \ | |
| libass-dev \ | |
| libfreetype6-dev \ | |
| libgnutls28-dev \ | |
| libsdl2-dev \ | |
| libtool \ | |
| libva-dev \ | |
| libvdpau-dev \ | |
| libvorbis-dev \ | |
| libxcb1-dev \ | |
| libxcb-shm0-dev \ | |
| libxcb-xfixes0-dev \ | |
| pkg-config \ | |
| texinfo \ | |
| wget \ | |
| yasm \ | |
| zlib1g-dev \ | |
| mingw-w64 | |
| sudo apt-get -y install nasm | |
| sudo apt-get -y install libx264-dev | |
| sudo apt-get -y install libx265-dev libnuma-dev | |
| sudo apt-get -y install libvpx-dev | |
| sudo apt-get -y install libfdk-aac-dev | |
| sudo apt-get -y install libmp3lame-dev | |
| sudo apt-get -y install libopus-dev | |
| # https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#Compiling | |
| - name: Setup | FFmpeg Build Tools [macOS] | |
| if: matrix.os == 'macOS-latest' | |
| run: | | |
| brew install automake fdk-aac lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora x264 x265 xvid nasm | |
| - name: Build | FFmpeg | |
| run: | | |
| pushd crates/iori | |
| ./build/build.rs ${{ matrix.target }} | |
| popd | |
| - name: Deploy | Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.target }} | |
| path: crates/iori/tmp/ffmpeg_build | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| name: iori-x86_64-unknown-linux-gnu | |
| # - target: x86_64-unknown-linux-musl | |
| # os: ubuntu-latest | |
| # name: iori-x86_64-unknown-linux-musl | |
| - target: x86_64-pc-windows-gnu | |
| os: ubuntu-latest | |
| name: iori-x86_64-pc-windows-gnu | |
| - target: x86_64-apple-darwin | |
| os: macOS-latest | |
| name: iori-x86_64-apple-darwin | |
| - target: aarch64-apple-darwin | |
| os: macOS-latest | |
| name: iori-arm64-apple-darwin | |
| needs: [ffmpeg-build] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: true | |
| steps: | |
| - name: Setup | Checkout | |
| uses: actions/[email protected] | |
| - name: Setup | Cache Cargo | |
| uses: actions/[email protected] | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Setup | Cache Cargo Target | |
| uses: actions/[email protected] | |
| with: | |
| path: target | |
| key: ${{ matrix.target }}-cargo-target | |
| - name: Setup | Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| profile: minimal | |
| target: ${{ matrix.target }} | |
| - name: Setup | Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup | Compiled FFmpeg | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.target }} | |
| path: ${{ github.workspace }}/crates/iori/tmp/ffmpeg_build | |
| - name: Setup | Environment [-nix] | |
| if: matrix.target != 'x86_64-pc-windows-gnu' | |
| run: | | |
| echo FFMPEG_INCLUDE_DIR="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/include" >> $GITHUB_ENV | |
| echo FFMPEG_PKG_CONFIG_PATH="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/lib/pkgconfig" >> $GITHUB_ENV | |
| echo PKG_CONFIG_PATH_FOR_TARGET="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/lib/pkgconfig" >> $GITHUB_ENV | |
| echo PKG_CONFIG_ALLOW_CROSS=1 >> $GITHUB_ENV | |
| - name: Setup | Environment [Windows] | |
| if: matrix.target == 'x86_64-pc-windows-gnu' | |
| run: | | |
| sudo apt-get update -qq && sudo apt-get -y install \ | |
| mingw-w64 | |
| echo FFMPEG_INCLUDE_DIR="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/include" >> $GITHUB_ENV | |
| echo FFMPEG_LIBS_DIR="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/lib" >> $GITHUB_ENV | |
| echo PKG_CONFIG_PATH_FOR_TARGET="${{ github.workspace }}/crates/iori/tmp/ffmpeg_build/lib/pkgconfig" >> $GITHUB_ENV | |
| echo PKG_CONFIG_ALLOW_CROSS=1 >> $GITHUB_ENV | |
| - name: Setup tmate session | |
| if: matrix.target == 'x86_64-pc-windows-gnu' | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| detached: true | |
| - name: Build | Build | |
| shell: bash | |
| run: | | |
| cargo build --release --locked --features shiori/ffmpeg --target ${{ matrix.target }} --workspace --exclude srr | |
| - name: PostBuild | Prepare artifacts [Windows] | |
| if: matrix.target == 'x86_64-pc-windows-gnu' | |
| shell: bash | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| strip minyami.exe | |
| strip ssadecrypt.exe | |
| strip shiori.exe | |
| mkdir ../../../${{ matrix.name }} | |
| mv minyami.exe ssadecrypt.exe shiori.exe ../../../${{ matrix.name }} | |
| cd - | |
| - name: PostBuild | Prepare artifacts [-nix] | |
| if: matrix.target != 'x86_64-pc-windows-gnu' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| strip minyami || true | |
| strip ssadecrypt || true | |
| strip shiori || true | |
| mkdir ../../../${{ matrix.name }} | |
| mv minyami ssadecrypt shiori ../../../${{ matrix.name }} | |
| cd - | |
| - name: Deploy | Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: ${{ matrix.name }}/ |