Skip to content

wrfed

wrfed #111

name: CI | Build & Test
on:
push:
pull_request:
jobs:
build-docker:
name: Build docker images
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
# - arm64
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker caching
uses: jpribyl/[email protected]
continue-on-error: true
- name: Build lottie-to-apng
run: docker build -t lottie-to-apng:${{ matrix.platform }} --target lottie-to-apng --platform ${{ matrix.platform }} .
- name: Upload lottie-to-apng as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-apng:${{ matrix.platform }}
- name: Build lottie-to-gif
run: docker build -t lottie-to-gif:${{ matrix.platform }} --target lottie-to-gif --platform ${{ matrix.platform }} .
- name: Upload lottie-to-gif as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-gif:${{ matrix.platform }}
- name: Build lottie-to-png
run: docker build -t lottie-to-png:${{ matrix.platform }} --target lottie-to-png --platform ${{ matrix.platform }} .
- name: Upload lottie-to-png as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-png:${{ matrix.platform }}
- name: Build lottie-to-webp
run: docker build -t lottie-to-webp:${{ matrix.platform }} --target lottie-to-webp --platform ${{ matrix.platform }} .
- name: Upload lottie-to-webp as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-webp:${{ matrix.platform }}
test-docker:
name: Run tests
needs: build-docker
runs-on: ubuntu-latest
strategy:
matrix:
image:
- apng
- gif
- png
- webp
platform:
- amd64
# - arm64
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Download ${{ matrix.image }} image as artefact
uses: ishworkh/[email protected]
with:
image: lottie-to-${{ matrix.image }}:${{ matrix.platform }}
- uses: actions/checkout@v3
- name: Run tests
run: docker run --rm -v $(pwd)/test-files:/source --platform ${{ matrix.platform }} lottie-to-${{ matrix.image }}:${{ matrix.platform }}
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.linux.${{ matrix.platform }}.${{ matrix.image }}
path: test-files
build-darwin:
name: Build MacOS executable
runs-on: macos-latest
steps:
- name: Install Conan
run: pip3 install conan==2.0.10
- uses: actions/checkout@v3
- name: Detect conan profile
run: conan profile detect
- name: Install conan dependencies
run: conan install . --build=missing
- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build .
- name: Upload executable as artifact
uses: actions/upload-artifact@v3
with:
name: lottie-to-png.darwin.amd64
path: bin/lottie_to_png
test-darwin:
name: Test MacOS
needs: build-darwin
runs-on: macos-latest
strategy:
matrix:
case:
- apng
- gif
- png
- webp
steps:
- uses: actions/checkout@v3
- name: Install run-time dependencies
run: |
[[ "${{ matrix.case }}" == "apng" ]] && brew install ffmpeg || echo ok;
[[ "${{ matrix.case }}" == "gif" ]] && brew install gifski || echo ok;
[[ "${{ matrix.case }}" == "webp" ]] && brew install webp || echo ok;
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: lottie-to-png.darwin.amd64
path: bin
- name: Run tests
run: |
chmod +x bin/lottie_to_png && \
bash -c "\
find test-files -type f \( -iname \*.json -o -iname \*.lottie -o -iname \*.tgs \) | while IFS=$'\n' read -r FILE; do \
echo Converting \${FILE}... && ./bin/lottie_to_${{ matrix.case }}.sh \$FILE && echo Done.; \
done \
"
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.darwin.amd64.${{ matrix.case }}
path: test-files
build-windows:
name: Build Windows executable
runs-on: windows-latest
steps:
- name: Install Conan
run: pip3 install conan==2.0.10
- uses: actions/checkout@v3
- name: Detect conan profile
run: conan profile detect
- name: Install conan dependencies
run: conan install . --build=missing
- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build .
continue-on-error: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lottie-to-png.win.amd64
path: .
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.windows.amd64.${{ matrix.case }}
path: test-files
release:
needs:
- test-docker
- test-darwin
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
steps:
- name: Download image as artefact
uses: ishworkh/[email protected]
with:
image: lottie-to-png:${{ matrix.platform }}
- uses: actions/checkout@v3
- name: Extract
run: |
id=$(docker create lottie-to-png:${{ matrix.platform }}) &&
docker cp $id:/usr/bin/lottie_to_png bin/ &&
docker rm -v $id
- name: Archive Release
uses: thedoctor0/[email protected]
with:
type: 'zip'
path: bin
filename: release-${{ matrix.platform }}.zip
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: release-${{ matrix.platform }}.zip
name: ${{ github.ref }}
allowUpdates: true
draft: true