Update build-images.yml #481
Workflow file for this run
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
name: Build images | |
on: | |
pull_request: | |
types: [opened, reopened] | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*' | |
schedule: | |
- cron: '0 3 * * 1' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
context: | |
- centos7-lcg100-gcc10 | |
- centos7-lcg101-gcc11 | |
- centos8-lcg100-gcc10 | |
- centos8-lcg101-gcc11 | |
- format10 | |
- format14 | |
- ubuntu1804_cuda | |
- ubuntu1804_cuda_oneapi | |
- ubuntu1804_rocm | |
- ubuntu1804_rocm_oneapi | |
- ubuntu2004 | |
- ubuntu2004_cuda | |
- ubuntu2004_cuda_oneapi | |
- ubuntu2004_rocm | |
- ubuntu2004_rocm_oneapi | |
- ubuntu2004_oneapi | |
- ubuntu2004_exatrkx | |
- ubuntu2204 | |
- ubuntu2204_clang | |
- ubuntu2204_cpp20 | |
- centos7-base | |
- centos8-base | |
- alma9-base | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check size of packages | |
run: | | |
df -h | |
echo "Listing 25 largest packages" | |
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 25 | |
echo "Removing large packages" | |
sudo apt-get remove -y '^dotnet-.*' | |
sudo apt-get remove -y '^llvm-.*' | |
sudo apt-get remove -y '^libllvm-.*' | |
sudo apt-get remove -y azure-cli | |
sudo apt-get remove -y google-cloud-cli | |
sudo apt-get remove -y google-chrome-stable | |
sudo apt-get remove -y firefox | |
sudo apt-get remove -y powershell | |
sudo apt-get remove -y mono-devel | |
sudo apt-get remove -y '^temurin.*' | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
rm -rf /usr/share/dotnet/ | |
df -h | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }} | |
VERSION=edge | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=pr-${{ github.event.number }} | |
fi | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
if [ "${{ github.event_name }}" = "push" ]; then | |
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}" | |
fi | |
echo ::set-output name=version::${VERSION} | |
echo ::set-output name=tags::${TAGS} | |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
- uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ${{ matrix.context }} | |
tags: ${{ steps.prep.outputs.tags }} | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }}:buildcache | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }}:buildcache,mode=max |