name: Dockcross CI on: push: branches: - "*" pull_request: branches: - "*" workflow_dispatch: env: OCI_EXE: docker ORG: dockcross BUILD_IMAGE_ARGS: --cache-from type=gha --cache-to type=gha,mode=max jobs: base: name: base runs-on: ubuntu-22.04 steps: - name: checkout code uses: actions/checkout@v6 with: submodules: "recursive" fetch-depth: 1 - name: build run: make base - name: test run: make base.test - name: archive base run: | mkdir -p cache docker save ${{ env.ORG }}/base:latest | xz -e6 -T0 > ./cache/base.tar.xz - name: save base uses: actions/upload-artifact@v7 with: name: cache path: ./cache retention-days: 3 - name: Login to Docker Hub if: github.ref == 'refs/heads/master' uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - name: deploy if: github.ref == 'refs/heads/master' run: make base.push base-arm64: name: base-arm64 runs-on: ubuntu-22.04-arm steps: - name: checkout code uses: actions/checkout@v6 with: submodules: "recursive" fetch-depth: 1 - name: build run: make base - name: test run: make base.test - name: archive base run: | mkdir -p cache docker save ${{ env.ORG }}/base:latest | xz -e6 -T0 > ./cache/base.tar.xz - name: save base uses: actions/upload-artifact@v7 with: name: cache-arm64 path: ./cache retention-days: 3 images: needs: [base, base-arm64] runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04, ubuntu-22.04-arm] arch_name: # Android images - { image: "android-arm", multiarch: "" } - { image: "android-arm64", multiarch: "" } - { image: "android-x86", multiarch: "" } - { image: "android-x86_64", multiarch: "" } # Linux arm64/armv8 images - { image: "linux-arm64", multiarch: "yes" } - { image: "linux-arm64-lts", multiarch: "" } - { image: "linux-arm64-musl", multiarch: "" } - { image: "linux-arm64-full", multiarch: "" } # Linux mipsel images - { image: "linux-mipsel-lts", multiarch: "" } # Linux armv5 images - { image: "linux-armv5", multiarch: "" } - { image: "linux-armv5-musl", multiarch: "" } - { image: "linux-armv5-uclibc", multiarch: "" } # Linux armv6 images - { image: "linux-armv6", multiarch: "" } - { image: "linux-armv6-lts", multiarch: "" } - { image: "linux-armv6-musl", multiarch: "" } # Linux armv7 images - { image: "linux-armv7", multiarch: "" } - { image: "linux-armv7a", multiarch: "" } - { image: "linux-armv7a-lts", multiarch: "" } - { image: "linux-armv7-lts", multiarch: "" } - { image: "linux-armv7l-musl", multiarch: "" } # Linux x86 images - { image: "linux-x86", multiarch: "" } # Linux i686 images - { image: "linux-i686", multiarch: "" } # Linux x86_64 images - { image: "linux-x64", multiarch: "" } - { image: "linux-x64-tinycc", multiarch: "" } - { image: "linux-x64-clang", multiarch: "" } - { image: "linux-x86_64-full", multiarch: "" } # Linux riscv images - { image: "linux-riscv32", multiarch: "" } - { image: "linux-riscv64", multiarch: "" } # Linux s390x images - { image: "linux-s390x", multiarch: "" } # Linux loongarch64 images - { image: "linux-loongarch64", multiarch: "" } # Linux mips images - { image: "linux-mips", multiarch: "" } - { image: "linux-mips-uclibc", multiarch: "" } - { image: "linux-mips-lts", multiarch: "" } # Linux ppc images - { image: "linux-ppc", multiarch: "" } - { image: "linux-ppc64le", multiarch: "" } - { image: "linux-ppc64le-lts", multiarch: "" } # Linux m68k images - { image: "linux-m68k-uclibc", multiarch: "" } # Linux xtensa images - { image: "linux-xtensa-uclibc", multiarch: "" } # Windows x86_64 images - { image: "windows-static-x64", multiarch: "" } - { image: "windows-static-x64-posix", multiarch: "" } - { image: "windows-shared-x64", multiarch: "" } - { image: "windows-shared-x64-posix", multiarch: "" } # Windows x86 images - { image: "windows-static-x86", multiarch: "" } - { image: "windows-shared-x86", multiarch: "" } # Windows arm images - { image: "windows-armv7", multiarch: "" } - { image: "windows-arm64", multiarch: "" } # manylinux_2_28 images - { image: "manylinux_2_28-x64", multiarch: "" } - { image: "manylinux_2_28-aarch64", multiarch: "" } # manylinux_2_34 images - { image: "manylinux_2_34-x64", multiarch: "" } - { image: "manylinux_2_34-aarch64", multiarch: "" } # manylinux2014 images - { image: "manylinux2014-x86", multiarch: "" } - { image: "manylinux2014-x64", multiarch: "" } - { image: "manylinux2014-aarch64", multiarch: "" } # web-wasm/web-wasi images - { image: "web-wasm", multiarch: "yes" } - { image: "web-wasi", multiarch: "yes" } - { image: "web-wasi-threads", multiarch: "yes" } - { image: "web-wasi-emulated-threads", multiarch: "yes" } # Bare metal images - { image: "bare-armv7emhf-nano_newlib", multiarch: "" } steps: - name: checkout code uses: actions/checkout@v6 with: submodules: "recursive" fetch-depth: 1 - name: set host_arch run: | echo "HOST_ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')" >> $GITHUB_ENV - name: download base (amd64) if: env.HOST_ARCH == 'amd64' uses: actions/download-artifact@v8 with: name: cache path: ./cache - name: download base (arm64) if: env.HOST_ARCH == 'arm64' uses: actions/download-artifact@v8 with: name: cache-arm64 path: ./cache - name: load base run: xz -d -k < ./cache/base.tar.xz | docker load - name: build if: matrix.arch_name.multiarch == 'yes' || env.HOST_ARCH == 'amd64' run: make ${{ matrix.arch_name.image }} - name: basic test if: matrix.arch_name.multiarch == 'yes' || env.HOST_ARCH == 'amd64' run: make ${{ matrix.arch_name.image }}.test - name: extra tests if: matrix.arch_name.multiarch == 'yes' || env.HOST_ARCH == 'amd64' run: make ${{ matrix.arch_name.image }}.test-extra - name: archive ${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }} if: matrix.arch_name.multiarch == 'yes' run: | mkdir -p cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }} docker tag ${{ env.ORG }}/${{ matrix.arch_name.image }}:latest ${{ env.ORG }}/${{ matrix.arch_name.image }}:latest-${{ env.HOST_ARCH }} docker save ${{ env.ORG }}/${{ matrix.arch_name.image }}:latest-${{ env.HOST_ARCH }} | xz -e6 -T0 > ./cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}/${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}.tar.xz - name: save ${{ matrix.arch_name.image }}-${{ matrix.os }} uses: actions/upload-artifact@v7 if: matrix.arch_name.multiarch == 'yes' with: name: cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }} path: ./cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }} retention-days: 3 - name: Login to Docker Hub if: github.ref == 'refs/heads/master' && matrix.arch_name.multiarch != 'yes' && env.HOST_ARCH == 'amd64' uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - name: deploy-not-multi-arch if: github.ref == 'refs/heads/master' && matrix.arch_name.multiarch != 'yes' && env.HOST_ARCH == 'amd64' run: make ${{ matrix.arch_name.image }}.push deploy-multi-arch-images: needs: - images runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: image_name: ["linux-arm64", "web-wasm", "web-wasi", "web-wasi-threads", "web-wasi-emulated-threads"] steps: - name: checkout code uses: actions/checkout@v6 with: submodules: "recursive" fetch-depth: 1 - name: download ${{ matrix.image_name }}-amd64 uses: actions/download-artifact@v8 with: name: cache-${{ matrix.image_name }}-amd64 path: ./cache-${{ matrix.image_name }}-amd64 - name: download ${{ matrix.image_name }}-arm64 uses: actions/download-artifact@v8 with: name: cache-${{ matrix.image_name }}-arm64 path: ./cache-${{ matrix.image_name }}-arm64 - name: load images run: | xz -d -k < ./cache-${{ matrix.image_name }}-amd64/${{ matrix.image_name }}-amd64.tar.xz | docker load xz -d -k < ./cache-${{ matrix.image_name }}-arm64/${{ matrix.image_name }}-arm64.tar.xz | docker load - name: Login to Docker Hub if: github.ref == 'refs/heads/master' uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - name: Install manifest-tool if: github.ref == 'refs/heads/master' run: | wget https://github.com/estesp/manifest-tool/releases/latest/download/binaries-manifest-tool.tar.gz -O - | tar -xz sudo cp manifest-tool-linux-amd64 /usr/local/bin/manifest-tool sudo chmod +x /usr/local/bin/manifest-tool - name: deploy-multi-arch if: github.ref == 'refs/heads/master' run: | docker push ${{ env.ORG }}/${{ matrix.image_name }}:latest-amd64 docker push ${{ env.ORG }}/${{ matrix.image_name }}:latest-arm64 manifest-tool push from-args \ --platforms linux/amd64,linux/arm64 \ --template ${{ env.ORG }}/${{ matrix.image_name }}:latest-ARCH \ --target ${{ env.ORG }}/${{ matrix.image_name }}:latest