Change GNU mirror #16
This file contains 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
on: | |
push: | |
paths: | |
- ".github/workflows/toolchain.yml" | |
- "Dockerfile.toolchain" | |
- "config.mak" | |
branches: | |
- main | |
## ## | |
## To trigger this workflow using `act` (https://github.com/nektos/act) you can do the following. | |
## Full run | |
## act push -j toolchain | |
## ## | |
name: Build Toolchains | |
jobs: | |
toolchain: | |
name: Build Toolchain - ${{ matrix.env.IMAGE_TAG }} | |
runs-on: ubuntu-22.04 | |
env: | |
HAVE_DOCKERHUB_LOGIN: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} | |
HAVE_GHCR_LOGIN: ${{ github.repository_owner != '' && secrets.GITHUB_TOKEN != '' }} | |
HAVE_QUAY_LOGIN: ${{ secrets.QUAY_USERNAME != '' && secrets.QUAY_TOKEN != '' }} | |
if: ${{ github.repository == 'BlackDex/rust-musl' }} | |
strategy: | |
# max-parallel: 1 # Use this when using `act`, since this could use a lot of memory | |
matrix: | |
# ARCH_COMMON_CONFIG are based upon the `"COMMON_CONFIG +=` additions extracted | |
# from the MUSL Dockerfiles here: https://github.com/rust-embedded/cross/tree/master/docker | |
env: | |
- IMAGE_TAG: x86_64-musl | |
TARGET: x86_64-unknown-linux-musl | |
- IMAGE_TAG: aarch64-musl | |
TARGET: aarch64-unknown-linux-musl | |
- IMAGE_TAG: armv7-musleabihf | |
TARGET: armv7-unknown-linux-musleabihf | |
ARCH_COMMON_CONFIG: "--with-arch=armv7-a --with-float=hard --with-mode=thumb --with-fpu=vfp" | |
- IMAGE_TAG: arm-musleabi | |
TARGET: arm-unknown-linux-musleabi | |
ARCH_COMMON_CONFIG: "--with-arch=armv6 --with-float=soft --with-mode=arm" | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
# This action is messing with the host caching when using `act` | |
- name: Setup Docker Buildx (setup-buildx-action) | |
if: ${{ !env.ACT }} | |
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
with: | |
driver-opts: | | |
network=host | |
# Use the DOCKER_BUILDKIT=1 env when using `act` | |
- name: Setup Docker Buildx (DOCKER_BUILDKIT=1) | |
if: ${{ env.ACT }} | |
shell: bash | |
run: | | |
echo "DOCKER_BUILDKIT=1" | tee -a "${GITHUB_ENV}" | |
- name: Determine Container Date Tag | |
shell: bash | |
run: | | |
# Get the current date | |
echo "TAG_DATE=$(date +'-%Y-%m-%d')" | tee -a "${GITHUB_ENV}" | |
- name: Login to DockerHub | |
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' }} | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Tags for DockerHub | |
if: ${{ env.ACT || env.HAVE_DOCKERHUB_LOGIN == 'true' }} | |
shell: bash | |
run: | | |
echo "tags=blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }},blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }}${TAG_DATE}" \ | |
| tee -a "${GITHUB_ENV}" | |
- name: Login to ghcr.io | |
if: ${{ env.HAVE_GHCR_LOGIN == 'true' }} | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tags for ghcr.io | |
if: ${{ env.ACT || env.HAVE_GHCR_LOGIN == 'true' }} | |
shell: bash | |
run: | | |
echo "tags=${tags:+${tags},}ghcr.io/blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }},ghcr.io/blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }}${TAG_DATE}" \ | |
| tee -a "${GITHUB_ENV}" | |
- name: Login to quay.io | |
if: ${{ env.HAVE_QUAY_LOGIN == 'true' }} | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Tags for quay.io | |
if: ${{ env.ACT || env.HAVE_QUAY_LOGIN == 'true' }} | |
shell: bash | |
run: | | |
echo "tags=${tags:+${tags},}quay.io/blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }},quay.io/blackdex/musl-toolchain:${{ matrix.env.IMAGE_TAG }}${TAG_DATE}" \ | |
| tee -a "${GITHUB_ENV}" | |
- name: Docker Build | |
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0 | |
with: | |
context: . | |
file: ./Dockerfile.toolchain | |
build-args: | | |
TARGET=${{ matrix.env.TARGET }} | |
ARCH_COMMON_CONFIG=${{ matrix.env.ARCH_COMMON_CONFIG }} | |
tags: ${{ env.tags }} | |
push: ${{ !env.ACT }} |