Skip to content
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:
- lottie-to-apng
- lottie-to-gif
- lottie-to-png
- lottie-to-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: ${{ matrix.image }}:${{ matrix.platform }}
- uses: actions/checkout@v3
- name: Run ${{ matrix.image }} tests
run: docker run --rm -v $(pwd)/test-files:/source --platform ${{ matrix.platform }} ${{ matrix.image }}:${{ matrix.platform }}
build-darwin:
name: Build MacOS executable
runs-on: macos-latest
steps:
- name: Install Conan
run: pip3 install conan==1.53.0
- uses: actions/checkout@v3
- name: Install conan dependencies
run: conan install --build=libpng --build=zlib .
- name: Build the app
run: cmake CMakeLists.txt && make
- 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:
- lottie_to_apng
- lottie_to_gif
- lottie_to_png
- lottie_to_webp
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: lottie-to-png.darwin.amd64
path: bin/lottie_to_png
- name: Test
run: |
find test-files -type f \( -iname \*.json -o -iname \*.lottie -o -iname \*.tgs \) | while IFS=$'\n' read -r FILE; do \
echo Converting \${FILE}... && ./bin/${{ matrix.case }}.sh \${WIDTH:+--width \$WIDTH} \${HEIGHT:+--height \$HEIGHT} \${FPS:+--fps \$FPS} \${QUALITY:+--quality \$QUALITY} \$FILE && echo Done.; \
done
release:
needs:
- test-docker
- test-darwin
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
steps:
- name: Download ${{ matrix.image }} 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