free up disk space #7
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: Build Notebooks | |
permissions: | |
packages: write | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
gen: | |
name: Generate job matrix | |
runs-on: ubuntu-latest | |
outputs: | |
level0: ${{ steps.gen.outputs.level0 }} | |
level1: ${{ steps.gen.outputs.level1 }} | |
level2: ${{ steps.gen.outputs.level2 }} | |
level3: ${{ steps.gen.outputs.level3 }} | |
level4: ${{ steps.gen.outputs.level4 }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- run: python3.12 gen_gha_matrix_jobs.py | |
id: gen | |
# base images | |
level0: | |
needs: [ "gen" ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen.outputs.level0) }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: "make ${{ matrix.target }}" | |
env: | |
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" | |
# images that only depend on base images | |
level1: | |
needs: [ "gen", "level0" ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen.outputs.level1) }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: "make ${{ matrix.target }}" | |
env: | |
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" | |
level2: | |
needs: [ "gen", "level1" ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen.outputs.level2) }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: "make ${{ matrix.target }}" | |
env: | |
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" | |
level3: | |
needs: [ "gen", "level2" ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen.outputs.level3) }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: "make ${{ matrix.target }}" | |
env: | |
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" | |
level4: | |
needs: [ "gen", "level3" ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen.outputs.level4) }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Free up additional disk space | |
# https://docs.github.com/en/actions/learn-github-actions/expressions | |
if: "${{ contains(matrix.target, 'cuda') || contains(matrix.target, 'pytorch') || contains(matrix.target, 'tensorflow') }}" | |
run: | | |
df -h | |
sudo rm -rf /usr/include & | |
sudo rm -rf /usr/local/lib/android & | |
sudo rm -rf /usr/local/share/boost & | |
sudo rm -rf /usr/local/lib/node_modules & | |
sudo rm -rf /usr/share/dotnet & | |
sudo rm -rf /opt/ghc & | |
sudo rm -rf /opt/hostedtoolcache/CodeQL & | |
# sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
sudo docker image prune --all --force & | |
wait | |
df -h | |
- run: "make ${{ matrix.target }}" | |
env: | |
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images" |