Switch to matrix configurations for possible arch builds later #24
This file contains 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: Update Opus | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/opus.yml' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build Opus for ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Linux x64", | |
os: ubuntu-latest, | |
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool git gcc cmake make", | |
args: "", | |
find-file: "libopus.so.*.*.*", | |
file: "libopus.so" | |
} | |
- { | |
name: "MacOS x64", | |
os: macos-latest, | |
install-deps: "brew install autoconf automake libtool git gcc cmake make", | |
args: "", | |
find-file: "libopus.*.*.*.dylib", | |
file: "libopus.dylib" | |
} | |
- { | |
name: "Windows x64", | |
os: windows-latest, | |
install-deps: "choco install git cmake make", | |
args: "-G \"Visual Studio 17 2022\" -A x64", | |
find-file: "opus.dll", | |
file: "opus.dll" | |
} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up MSBuild | |
if: matrix.config.os == 'windows-latest' | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
- name: Install dependencies | |
run: ${{ matrix.config.install-deps }} | |
- name: Checkout Opus | |
run: | | |
git clone https://gitlab.xiph.org/xiph/opus libs/opus | |
cd libs/opus | |
echo "OPUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV | |
git checkout "$OPUS_VERSION" | |
- name: Build on ${{ matrix.config.name }} | |
run: | | |
cmake -S . -B build ${{ matrix.config.args }} -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release | |
cmake --build build --config Release | |
rm "${{ github.workspace }}/libs/libopus/${{ matrix.config.find-file }}" | |
mv build/${{ matrix.config.find-file }} "${{ github.workspace }}/libs/libopus/${{ matrix.config.file }}" | |
- name: "Update ${{ matrix.config.file }}" | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "libs/libopus/" | |
default_author: github_actions | |
message: Update ${{ matrix.config.file }} to ${{ env.OPUS_VERSION }} | |
pull: '--rebase --autostash' | |
push: true |