even more fine tuning, really hate how i cant really test ci locally :( #77
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ dev, docker, main ] | |
| pull_request: | |
| branches: [ dev, main ] | |
| permissions: | |
| contents: read | |
| actions: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-test: | |
| name: Build & Test (${{ matrix.target_os }}-${{ matrix.platform }}) | |
| runs-on: ${{ matrix.runner_os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux builds | |
| - target_os: linux | |
| platform: x86_64 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.linux_x86_64 | |
| docker_platform: linux/amd64 | |
| run_tests: true | |
| - target_os: linux | |
| platform: arm64 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.linux_arm64 | |
| docker_platform: linux/arm64 | |
| run_tests: true | |
| - target_os: linux | |
| platform: arm32 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.linux_arm32 | |
| docker_platform: linux/arm/v7 | |
| run_tests: true | |
| # Windows builds (cross-compiled, tested with Wine) | |
| - target_os: windows | |
| platform: x86_64 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.windows_x86_64 | |
| docker_platform: linux/amd64 | |
| run_tests: true | |
| - target_os: windows | |
| platform: x86 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.windows_x86 | |
| docker_platform: linux/amd64 | |
| run_tests: true | |
| - target_os: windows | |
| platform: arm64 | |
| runner_os: ubuntu-latest | |
| dockerfile: Dockerfile.windows_arm64 | |
| docker_platform: linux/amd64 | |
| run_tests: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up QEMU (for ARM emulation) | |
| if: matrix.platform == 'arm64' || matrix.platform == 'arm32' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: linux/arm64,linux/arm/v7 | |
| - name: Build Docker image | |
| run: | | |
| docker buildx build \ | |
| --platform ${{ matrix.docker_platform }} \ | |
| --load \ | |
| -f bin/export/${{ matrix.dockerfile }} \ | |
| -t ggui-${{ matrix.target_os }}_${{ matrix.platform }}:latest \ | |
| . | |
| - name: Run build in Docker container | |
| run: | | |
| docker run \ | |
| --platform ${{ matrix.docker_platform }} \ | |
| --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| ggui-${{ matrix.target_os }}_${{ matrix.platform }}:latest | |
| - name: Verify build artifact | |
| run: | | |
| if [ "${{ matrix.target_os }}" = "linux" ]; then | |
| EXT=".a" | |
| else | |
| EXT=".lib" | |
| fi | |
| ARTIFACT="bin/export/libggui${EXT}" | |
| if [ -f "$ARTIFACT" ]; then | |
| echo "Build artifact created: $ARTIFACT" | |
| ls -lh "$ARTIFACT" | |
| else | |
| echo "Build artifact not found: $ARTIFACT" | |
| exit 1 | |
| fi | |
| - name: Run tests (Linux native/QEMU) | |
| if: matrix.run_tests == true && matrix.target_os == 'linux' | |
| run: | | |
| docker run \ | |
| --platform ${{ matrix.docker_platform }} \ | |
| --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| ggui-${{ matrix.target_os }}_${{ matrix.platform }}:latest \ | |
| bash -c "source bin/analytics/utils/common.sh && meson test -C \$(get_build_dir_for_arch release ${{ matrix.target_os }} ${{ matrix.platform }}) -v --print-errorlogs" | |
| - name: Run tests (Windows via Wine) | |
| if: matrix.run_tests == true && matrix.target_os == 'windows' | |
| run: | | |
| docker run \ | |
| --platform ${{ matrix.docker_platform }} \ | |
| --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| ggui-${{ matrix.target_os }}_${{ matrix.platform }}:latest \ | |
| bash -c "apt-get update && apt-get install -y wine64 wine32 && source bin/analytics/utils/common.sh && meson test -C \$(get_build_dir_for_arch release ${{ matrix.target_os }} ${{ matrix.platform }}) -v --print-errorlogs" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libggui-${{ matrix.target_os }}-${{ matrix.platform }} | |
| path: bin/export/libggui* | |
| retention-days: 7 | |
| - name: Upload test logs if tests fail | |
| if: failure() && matrix.run_tests == true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs-${{ matrix.target_os }}-${{ matrix.platform }} | |
| path: ./test/logs/ |