From 5e38bec7e8517852cd66ca620ac5180c70d50e66 Mon Sep 17 00:00:00 2001 From: maryla-uc Date: Wed, 2 Oct 2024 17:32:15 +0200 Subject: [PATCH] Add macOS artifacts to release (#2461) The binaries are not notarized, see #2460 --- .github/actions/setup-macos/action.yml | 5 +- ...x-artifacts.yml => ci-linux-artifacts.yml} | 22 ++---- .github/workflows/ci-macos-artifacts.yml | 76 +++++++++++++++++++ .github/workflows/ci-windows-artifacts.yml | 2 +- 4 files changed, 89 insertions(+), 16 deletions(-) rename .github/workflows/{ci-unix-artifacts.yml => ci-linux-artifacts.yml} (79%) create mode 100644 .github/workflows/ci-macos-artifacts.yml diff --git a/.github/actions/setup-macos/action.yml b/.github/actions/setup-macos/action.yml index 84586bcd5d..c6dc7fcd86 100644 --- a/.github/actions/setup-macos/action.yml +++ b/.github/actions/setup-macos/action.yml @@ -34,7 +34,10 @@ runs: sudo rm -rf /Library/Frameworks/Python.framework/ brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3 shell: bash - - name: Install non-library dependencies + - name: Install non-library test dependencies + # imagemagick is used in sh tests (not gtest tests) but we assume that no tests are run by the CI + # if gtest is off + if: ${{ inputs.gtest != 'OFF' }} run: brew install imagemagick shell: bash - name: Install AOM library diff --git a/.github/workflows/ci-unix-artifacts.yml b/.github/workflows/ci-linux-artifacts.yml similarity index 79% rename from .github/workflows/ci-unix-artifacts.yml rename to .github/workflows/ci-linux-artifacts.yml index 5abac10623..bdf2f9ccb1 100644 --- a/.github/workflows/ci-unix-artifacts.yml +++ b/.github/workflows/ci-linux-artifacts.yml @@ -1,6 +1,6 @@ # This workflow generates artifacts such as avifenc and avifdec for convenience. -name: CI Unix Static +name: CI Linux Release Artifacts on: release: types: [created] @@ -9,26 +9,20 @@ permissions: contents: read jobs: - build-static: + build-linux-artifacts: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest] # TODO: macos-latest + os: [ubuntu-latest] steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - uses: ./.github/actions/setup-linux - if: runner.os == 'Linux' with: codec-aom: "LOCAL" codec-dav1d: "LOCAL" libyuv: "LOCAL" - - uses: ./.github/actions/setup-macos - if: runner.os == 'macOS' - with: - codec-aom: "LOCAL" - codec-dav1d: "LOCAL" - name: Prepare libavif (cmake) run: > @@ -49,7 +43,7 @@ jobs: uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # 0.7.6 with: type: zip - filename: ${{ runner.os }}-artifacts.zip + filename: linux-artifacts.zip directory: build path: | avifenc @@ -61,13 +55,13 @@ jobs: with: # See https://docs.github.com/en/webhooks/webhook-events-and-payloads#release. upload_url: ${{ github.event.release.upload_url }} - asset_path: build/${{ runner.os }}-artifacts.zip - asset_name: ${{ runner.os }}-artifacts.zip + asset_path: build/linux-artifacts.zip + asset_name: linux-artifacts.zip asset_content_type: application/zip # Use the following instead of the above to test this workflow outside of a release event. # - name: Upload artifacts # uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 # with: - # name: ${{ runner.os }}-artifacts.zip - # path: build/${{ runner.os }}-artifacts.zip + # name: linux-artifacts.zip + # path: build/linux-artifacts.zip diff --git a/.github/workflows/ci-macos-artifacts.yml b/.github/workflows/ci-macos-artifacts.yml new file mode 100644 index 0000000000..61db3f7994 --- /dev/null +++ b/.github/workflows/ci-macos-artifacts.yml @@ -0,0 +1,76 @@ +# This workflow generates artifacts such as avifenc and avifdec for convenience. + +name: CI macOS Release Artifacts +on: + release: + types: [created] + +permissions: + contents: read + +jobs: + build-macos-artifacts: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + + steps: + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: ./.github/actions/setup-macos + with: + codec-aom: "LOCAL" + codec-dav1d: "LOCAL" + + - name: Prepare libavif (cmake) + run: > + cmake -G Ninja -S . -B build + -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF + -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_AOM_ENCODE=ON + -DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_DAV1D=LOCAL + -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBYUV=LOCAL + -DAVIF_ZLIBPNG=LOCAL -DAVIF_JPEG=LOCAL + -DAVIF_BUILD_EXAMPLES=OFF -DAVIF_BUILD_APPS=ON + -DAVIF_BUILD_TESTS=OFF -DAVIF_ENABLE_WERROR=ON + -DCMAKE_C_COMPILER=clang + - name: Build libavif (ninja) + working-directory: ./build + run: ninja + # TODO: notarize the binaries + - name: Create README.txt + run: | + cat <<'EOF' > build/README.txt + For security reasons, macOS might prevent these binaries from running. + If you get a message saying that "Apple cannot check it for malicious software", + run this command once: + $ sudo xattr -r -d com.apple.quarantine ./avifenc ./avifdec + See also https://github.com/AOMediaCodec/libavif/issues/2460 + EOF + - name: Archive artifacts + uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # 0.7.6 + with: + type: zip + filename: ${{ runner.os }}-artifacts.zip + directory: build + path: | + avifenc + avifdec + README.txt + - name: Upload artifacts + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # See https://docs.github.com/en/webhooks/webhook-events-and-payloads#release. + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/${{ runner.os }}-artifacts.zip + asset_name: ${{ runner.os }}-artifacts.zip + asset_content_type: application/zip + + # Use the following instead of the above to test this workflow outside of a release event. + # - name: Upload artifacts + # uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + # with: + # name: ${{ runner.os }}-artifacts.zip + # path: build/${{ runner.os }}-artifacts.zip diff --git a/.github/workflows/ci-windows-artifacts.yml b/.github/workflows/ci-windows-artifacts.yml index 50dff90875..335f9ab929 100644 --- a/.github/workflows/ci-windows-artifacts.yml +++ b/.github/workflows/ci-windows-artifacts.yml @@ -1,6 +1,6 @@ # This workflow generates artifacts such as avifenc.exe and avifdec.exe for convenience. -name: CI Windows Artifacts +name: CI Windows Release Artifacts on: release: types: [created]