Building Docker Images #644
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: Building Docker Images | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| versions_file_url: | |
| description: 'URL of the versions.json file to use for android and wasm' | |
| required: false | |
| default: '' | |
| vtk_version_override: | |
| description: 'Hash or tag of VTK to build which overrides the one from versions.json file to use for android and wasm' | |
| required: false | |
| default: '' | |
| jobs: | |
| build_f3d-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: ${{ github.ref == 'refs/heads/main' }} | |
| tags: ghcr.io/f3d-app/f3d-ci:latest | |
| context: "{{defaultContext}}:ci" | |
| build_f3d-wasm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Recover versions.json to parse | |
| working-directory: ${{github.workspace}} | |
| shell: bash | |
| run: curl -s ${{ github.event.inputs.versions_file_url || 'https://raw.githubusercontent.com/f3d-app/f3d/master/.github/workflows/versions.json' }} > ./versions.json | |
| - name: Set default versions | |
| id: set_default_versions | |
| uses: f3d-app/default-versions-action@main | |
| with: | |
| file: ./versions.json | |
| - name: Check VTK version override | |
| id: vtk_version_override | |
| shell: bash | |
| run: | | |
| vtk_ver=${{ steps.set_default_versions.outputs.vtk_commit_sha }} | |
| docker_timestamp=${{ steps.set_default_versions.outputs.docker_timestamp }} | |
| vtk_ver_over=${{ github.event.inputs.vtk_version_override }} | |
| docker_tag=latest | |
| [ -z $vtk_ver_over ] || vtk_ver=$vtk_ver_over | |
| [ -z $vtk_ver_over ] || docker_timestamp+=_$vtk_ver_over | |
| [ -z $vtk_ver_over ] || docker_tag=nightly | |
| echo "F3D_VTK_VERSION=$vtk_ver" >> $GITHUB_ENV | |
| echo "F3D_DOCKER_TIMESTAMP=$docker_timestamp" >> $GITHUB_ENV | |
| echo "F3D_DOCKER_TAG=$docker_tag" >> $GITHUB_ENV | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: ${{ github.ref == 'refs/heads/main' }} | |
| tags: ghcr.io/f3d-app/f3d-wasm:${{ env.F3D_DOCKER_TIMESTAMP }}, ghcr.io/f3d-app/f3d-wasm:${{ env.F3D_DOCKER_TAG }} | |
| context: "{{defaultContext}}:webassembly" | |
| build-args: | | |
| CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| ASSIMP_VERSION=${{ steps.set_default_versions.outputs.assimp_version }} | |
| DRACO_VERSION=${{ steps.set_default_versions.outputs.draco_version }} | |
| OCCT_VERSION=${{ steps.set_default_versions.outputs.occt_version }} | |
| WEBP_VERSION=${{ steps.set_default_versions.outputs.webp_version }} | |
| WEBIFC_VERSION=${{ steps.set_default_versions.outputs.webifc_version }} | |
| VTK_VERSION=${{ env.F3D_VTK_VERSION }} | |
| build_f3d-android: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [armeabi-v7a, arm64-v8a, x86, x86_64] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Recover versions.json to parse | |
| working-directory: ${{github.workspace}} | |
| shell: bash | |
| run: curl -s ${{ github.event.inputs.versions_file_url == '' && 'https://raw.githubusercontent.com/f3d-app/f3d/master/.github/workflows/versions.json' || github.event.inputs.versions_file_url }} > ./versions.json | |
| - name: Set default versions | |
| id: set_default_versions | |
| uses: f3d-app/default-versions-action@main | |
| with: | |
| file: ./versions.json | |
| - name: Check VTK version override | |
| id: vtk_version_override | |
| shell: bash | |
| run: | | |
| vtk_ver=${{ steps.set_default_versions.outputs.vtk_commit_sha }} | |
| docker_timestamp=${{ steps.set_default_versions.outputs.docker_timestamp }} | |
| vtk_ver_over=${{ github.event.inputs.vtk_version_override }} | |
| docker_tag=latest | |
| [ -z $vtk_ver_over ] || vtk_ver=$vtk_ver_over | |
| [ -z $vtk_ver_over ] || docker_timestamp+=_$vtk_ver_over | |
| [ -z $vtk_ver_over ] || docker_tag=nightly | |
| echo "F3D_VTK_VERSION=$vtk_ver" >> $GITHUB_ENV | |
| echo "F3D_DOCKER_TIMESTAMP=$docker_timestamp" >> $GITHUB_ENV | |
| echo "F3D_DOCKER_TAG=$docker_tag" >> $GITHUB_ENV | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: ${{ github.ref == 'refs/heads/main' }} | |
| tags: ghcr.io/f3d-app/f3d-android-${{ matrix.arch }}:${{ env.F3D_DOCKER_TIMESTAMP }}, ghcr.io/f3d-app/f3d-android-${{ matrix.arch }}:${{ env.F3D_DOCKER_TAG }} | |
| context: "{{defaultContext}}:android" | |
| build-args: | | |
| ANDROID_API=28 | |
| ANDROID_ARCH=${{ matrix.arch }} | |
| ANDROID_NDK=r27d | |
| CMAKE_BUILD_PARALLEL_LEVEL=4 | |
| ALEMBIC_VERSION=${{ steps.set_default_versions.outputs.alembic_version }} | |
| ASSIMP_VERSION=${{ steps.set_default_versions.outputs.assimp_version }} | |
| DRACO_VERSION=${{ steps.set_default_versions.outputs.draco_version }} | |
| IMATH_VERSION=v3.1.12 | |
| OCCT_VERSION=${{ steps.set_default_versions.outputs.occt_version }} | |
| OPENEXR_VERSION=${{ steps.set_default_versions.outputs.openexr_version }} | |
| WEBP_VERSION=${{ steps.set_default_versions.outputs.webp_version }} | |
| WEBIFC_VERSION=${{ steps.set_default_versions.outputs.webifc_version }} | |
| VTK_VERSION=${{ env.F3D_VTK_VERSION }} | |
| build_f3d-superbuild-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push superbuild | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: ${{ github.ref == 'refs/heads/main' }} | |
| tags: ghcr.io/f3d-app/f3d-superbuild-ci:latest | |
| context: "{{defaultContext}}:superbuild" | |
| build_f3d-wheels-manylinux-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push wheels | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: ${{ github.ref == 'refs/heads/main' }} | |
| tags: ghcr.io/f3d-app/f3d-wheels-manylinux-ci:latest | |
| context: "{{defaultContext}}:wheels-manylinux" |