Add Github Actions (#1) #11
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: Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| logLevel: | |
| description: Log Level | |
| default: info | |
| type: choice | |
| options: | |
| - debug | |
| - error | |
| - fatal | |
| - info | |
| - panic | |
| - warning | |
| environment: | |
| description: Environment | |
| default: test | |
| jobs: | |
| test-amd64: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| dockerfile: Dockerfile.amd64 | |
| tag: tinyclib:amd64 | |
| test: amd64 | |
| steps: | |
| - name: Docker Setup QEMU | |
| if: matrix.platform != 'linux/amd64' | |
| uses: docker/setup-qemu-action@v3.6.0 # v3.6.0 - latest as of 2025-04-27 | |
| with: | |
| platforms: all | |
| - name: Docker Setup Buildx | |
| uses: docker/setup-buildx-action@v3.10.0 # v3.10.0 - latest as of 2025-04-27 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # v4.2.2 - latest as of 2025-04-27 | |
| - name: Create Buildx | |
| run: | | |
| docker buildx create --name tests --use | |
| docker buildx inspect --bootstrap | |
| - name: Build images | |
| run: | | |
| docker images | |
| docker buildx ls --no-trunc | |
| docker buildx build --platform ${{ matrix.platform }} -f scripts/tests/docker/${{ matrix.dockerfile }} -t ${{ matrix.tag }} . --load | |
| docker images | |
| - name: Test | |
| run: | | |
| for platform in ${{ matrix.platform }}; do | |
| for tag in ${{ matrix.tag }}; do | |
| echo "Running container for platform: $platform, tag: $tag" | |
| docker run --platform $platform $tag | |
| done | |
| done | |
| test-arm64: | |
| runs-on: ubuntu-24.04-arm | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: linux/arm64 | |
| dockerfile: Dockerfile.arm64 | |
| tag: tinyclib:arm64 | |
| test: arm64 | |
| - platform: linux/arm/v6 | |
| dockerfile: Dockerfile.armv6 | |
| tag: tinyclib:armv6 | |
| test: armv6 | |
| - platform: linux/arm/v7 | |
| dockerfile: Dockerfile.armv7 | |
| tag: tinyclib:armv7 | |
| test: armv7 | |
| - platform: linux/arm64/v8 | |
| dockerfile: Dockerfile.armv8 | |
| tag: tinyclib:armv8 | |
| test: armv8 | |
| steps: | |
| - name: Docker Setup Buildx | |
| uses: docker/setup-buildx-action@v3.10.0 # v3.10.0 - latest as of 2025-04-27 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # v4.2.2 - latest as of 2025-04-27 | |
| - name: Create Buildx | |
| run: | | |
| docker buildx create --name tests --use | |
| docker buildx inspect --bootstrap | |
| - name: Build images | |
| run: | | |
| docker images | |
| docker buildx ls --no-trunc | |
| docker buildx build --platform ${{ matrix.platform }} -f scripts/tests/docker/${{ matrix.dockerfile }} -t ${{ matrix.tag }} . --load | |
| docker images | |
| - name: Test | |
| run: | | |
| for platform in ${{ matrix.platform }}; do | |
| for tag in ${{ matrix.tag }}; do | |
| echo "Running container for platform: $platform, tag: $tag" | |
| docker run --platform $platform $tag | |
| done | |
| done |