Skip to content

Commit

Permalink
Add release
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-asriyan committed Oct 23, 2023
1 parent b0b3cee commit fbf04a3
Showing 1 changed file with 209 additions and 12 deletions.
221 changes: 209 additions & 12 deletions .github/workflows/ci-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
pull_request:

jobs:
build:
build-docker:
name: Build docker images
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
# - arm64
env:
DOCKER_BUILDKIT: 1
steps:
Expand Down Expand Up @@ -57,30 +57,227 @@ jobs:
with:
image: lottie-to-webp:${{ matrix.platform }}

test:
test-docker:
name: Run tests
needs: build
needs: build-docker
runs-on: ubuntu-latest
strategy:
matrix:
image:
- lottie-to-apng
- lottie-to-gif
- lottie-to-png
- lottie-to-webp
- apng
- gif
- png
- webp
platform:
- amd64
- arm64
# - 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 }}
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 -s build_type=Release

- name: Invoke 'conan-release' preset
run: cmake --preset conan-release

- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build . --config Release

- 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: Run ${{ matrix.image }} tests
run: docker run --rm -v $(pwd)/test-files:/source --platform ${{ matrix.platform }} ${{ matrix.image }}:${{ matrix.platform }}
- name: Detect conan profile
run: conan profile detect

- name: Install conan dependencies
run: conan install . --build=missing -s build_type=Release

- name: Invoke 'conan-default' preset
run: cmake --preset conan-default

- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build . --config Release
continue-on-error: true

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lottie-to-png.win.amd64.exe
path: bin/Release/lottie_to_png.exe

test-windows:
name: Test Windows
needs: build-windows
runs-on: windows-latest
strategy:
matrix:
case:
- apng
- gif
- png
steps:
- uses: actions/checkout@v3

- name: Install run-time dependencies
shell: bash
run: |
[[ "${{ matrix.case }}" == "apng" ]] && winget install ffmpeg || echo ok;
[[ "${{ matrix.case }}" == "gif" ]] && cargo install gifski || echo ok;
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: lottie-to-png.win.amd64.exe
path: bin

- name: Run tests
shell: bash
run: |
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}... && sh ./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.windows.amd64.${{ matrix.case }}
path: test-files

release-linux:
name: Release linux executables
needs:
- test-docker
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: softprops/action-gh-release@v1
with:
files: release-${{ matrix.platform }}.zip
draft: true

release-darwin:
name: Release darwin executables
needs:
- test-darwin
runs-on: ubuntu-latest
steps:
- name: Extract
run: echo stub

release-windows:
name: Release windows executables
needs:
- test-windows
runs-on: ubuntu-latest
steps:
- name: Extract
run: echo stub

0 comments on commit fbf04a3

Please sign in to comment.