Add macOS arm64 build #59
Workflow file for this run
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
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "**" | |
- "!main" | |
paths: | |
- misc/mupdf/version | |
- .github/workflows/mupdf.yml | |
name: MuPDF | |
jobs: | |
version: | |
name: Version | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.mupdf-version.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Export MuPDF Version | |
id: mupdf-version | |
run: cat misc/mupdf/version | awk '{$1=$1};1' | { read version; echo "::set-output name=version::${version}"; } | |
build: | |
name: Build | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
include: | |
- alias: linux | |
os: ubuntu-latest | |
architecture: x86-64 | |
- alias: macos | |
os: macos-latest | |
architecture: arm64 | |
runs-on: ${{ matrix.os }} | |
needs: version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout MuPDF code | |
uses: actions/checkout@v4 | |
with: | |
repository: ArtifexSoftware/mupdf | |
ref: ${{needs.version.outputs.version}} | |
submodules: true | |
path: tmp | |
- name: Install macOS dependencies | |
if: matrix.alias == 'macos' | |
run: brew install autoconf gcc | |
- name: Build MuPDF | |
working-directory: tmp | |
# The -j1 is important to avoid 'fork: Resource temporarily unavailable' errors. | |
run: make -j1 libs | |
- name: Update lib | |
run: | | |
mkdir -p misc/mupdf/lib/${{ matrix.architecture }}-${{ matrix.alias }} | |
cp tmp/build/release/libmupdf.a misc/mupdf/lib/${{ matrix.architecture }}-${{ matrix.alias }}/ | |
cp tmp/build/release/libmupdf-third.a misc/mupdf/lib/${{ matrix.architecture }}-${{ matrix.alias }}/ | |
- name: Remove MuPDF temporary folder | |
run: rm -Rf tmp | |
- name: Commit updated library | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git pull | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
git add . | |
git commit -am 'Update MuPDF library for ${{ matrix.alias }}' | |
git pull --rebase | |
git push | |
fi | |
header: | |
name: Header | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout MuPDF code | |
uses: actions/checkout@v4 | |
with: | |
repository: ArtifexSoftware/mupdf | |
ref: ${{needs.version.outputs.version}} | |
path: tmp | |
- name: Update headers | |
run: | | |
rm -Rf misc/mupdf/include/mupdf | |
cp -R tmp/include/mupdf misc/mupdf/include/ | |
- name: Remove MuPDF temporary folder | |
run: rm -Rf tmp | |
- name: Commit updated headers | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
git add . | |
git commit -am 'Update MuPDF headers' | |
git pull --rebase | |
git push | |
fi |