Skip to content

Commit

Permalink
Add ci-unix-artifacts.yml
Browse files Browse the repository at this point in the history
Similar to ci-windows-artifacts but for linux and macos.
  • Loading branch information
y-guyon committed Sep 26, 2024
1 parent e02e675 commit 62713e0
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 62 deletions.
119 changes: 57 additions & 62 deletions .github/workflows/ci-unix-artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,73 @@
# This workflow generates artifacts such as avifenc and avifdec for convenience.

name: CI Unix Static
on:
push:
pull_request:
paths:
- '.github/workflows/ci-unix-static.yml'
- '**CMakeLists.txt'
- 'cmake/**'
- 'ext/**'
release:
types: [created]

permissions:
contents: read

# Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-static:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-13]
build-type: [Release, Debug]
include:
- runs-on: ubuntu-24.04
compiler: gcc
gcc: 14
os: [ubuntu-latest] # TODO: macos-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: ./.github/actions/setup-linux
if: runner.os == 'Linux'
with:
codec-aom: 'LOCAL'
codec-dav1d: 'LOCAL'
codec-rav1e: 'LOCAL'
gcc-version: ${{ matrix.gcc }}
libxml2: 'LOCAL'
libyuv: 'LOCAL'
- uses: ./.github/actions/setup-macos
if: runner.os == 'macOS'
with:
codec-aom: 'LOCAL'
codec-dav1d: 'LOCAL'
codec-rav1e: 'LOCAL'
extra-cache-key: ${{ matrix.build-type }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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: >
cmake -G Ninja -S . -B build
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=OFF
-DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL
-DAVIF_CODEC_RAV1E=LOCAL -DAVIF_CODEC_SVT=LOCAL
-DAVIF_CODEC_LIBGAV1=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
working-directory: ./build
run: ninja
- name: Run AVIF Tests
working-directory: ./build
run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure
- name: Check static link bundling
run: |
cc -o avifenc -I./apps/shared -I./third_party/iccjpeg -I./include apps/avifenc.c \
apps/shared/*.c third_party/iccjpeg/iccjpeg.c build/libavif.a \
-lpng -ljpeg -lz -lm -ldl -lstdc++
- 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
-DCMAKE_C_FLAGS_RELEASE="-static" -DCMAKE_EXE_LINKER_FLAGS="-static"
- name: Build libavif (ninja)
working-directory: ./build
run: ninja
- name: Archive artifacts
uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # 0.7.6
with:
type: zip
filename: ${{ matrix.os }}-artifacts.zip
directory: build
path: |
avifenc
avifdec
- 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/${{ matrix.os }}-artifacts.zip
asset_name: ${{ matrix.os }}-artifacts.zip
asset_content_type: application/zip

./avifenc --help
# 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: ${{ matrix.os }}-artifacts.zip
# path: build/${{ matrix.os }}-artifacts.zip
7 changes: 7 additions & 0 deletions .github/workflows/ci-windows-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,10 @@ jobs:
asset_path: build/windows-artifacts.zip
asset_name: windows-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: windows-artifacts.zip
# path: build/windows-artifacts.zip

0 comments on commit 62713e0

Please sign in to comment.