Skip to content

Attempt to fix funtest docker race condition #837

Attempt to fix funtest docker race condition

Attempt to fix funtest docker race condition #837

Workflow file for this run

# Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE
name: ORT Docker Image
on:
workflow_dispatch:
inputs:
invalidate-cache:
description: 'Build all images disregarding existing version'
required: false
debug:
description: 'Debug docker build'
required: false
schedule:
- cron: '0 4 * * *'
pull_request:
paths:
- '.versions'
- 'Dockerfile'
- '.github/workflows/docker-ort.yml'
push:
branches:
- 'main'
tags:
- '*'
env:
REGISTRY: ghcr.io
permissions: write-all
jobs:
base_image:
name: Base image
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build base image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: base
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.JAVA_VERSION }}-jdk-${{ env.UBUNTU_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
JAVA_VERSION=${{ env.JAVA_VERSION }}
UBUNTU_VERSION=${{ env.UBUNTU_VERSION }}
nodejs_image:
name: NodeJS image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build NodeJS image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: nodejs
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.NODEJS_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
NODEJS_VERSION=${{ env.NODEJS_VERSION }}
NPM_VERSION=${{ env.NPM_VERSION }}
PNPM_VERSION=${{ env.PNPM_VERSION }}
YARN_VERSION=${{ env.YARN_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
python_image:
name: Python image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Python image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: python
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.PYTHON_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
CONAN_VERSION=${{ env.CONAN_VERSION }}
PIPTOOL_VERSION=${{ env.PIPTOOL_VERSION }}
PYENV_GIT_TAG=${{ env.PYENV_GIT_TAG }}
PYTHON_INSPECTOR_VERSION=${{ env.PYTHON_INSPECTOR_VERSION }}
PYTHON_PIPENV_VERSION=${{ env.PYTHON_PIPENV_VERSION }}
PYTHON_POETRY_VERSION=${{ env.PYTHON_POETRY_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
SCANCODE_VERSION=${{ env.SCANCODE_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
rust_image:
name: Rust image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Rust image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: rust
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.RUST_VERSION }}"
build-args: |
RUST_VERSION=${{ env.RUST_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
ruby_image:
name: Ruby image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Ruby image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: ruby
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.RUBY_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
RUBY_VERSION=${{ env.RUBY_VERSION }}
COCOAPODS_VERSION=${{ env.COCOAPODS_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
golang_image:
name: Golang image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Golang image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: golang
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.GO_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
GO_DEP_VERSION=${{ env.GO_DEP_VERSION }}
GO_VERSION=${{ env.GO_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
android_image:
name: Android image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Android image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: android
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.ANDROID_CMD_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
ANDROID_CMD_VERSION=${{ env.ANDROID_CMD_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
dart_image:
name: Dart image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Dart image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: dart
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.DART_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
DART_VERSION=${{ env.DART_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
dotnet_image:
name: Dotnet image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Dotnet image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: dotnet
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.DOTNET_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
DOTNET_VERSION=${{ env.DOTNET_VERSION }}
NUGET_INSPECTOR_VERSION=${{ env.NUGET_INSPECTOR_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
haskell_image:
name: Haskell image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Haskell image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: haskell
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.HASKELL_STACK_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
HASKELL_STACK_VERSION=${{ env.HASKELL_STACK_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
scala_image:
name: Scala image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Scala image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: scala
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.SBT_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
SBT_VERSION=${{ env.SBT_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
swift_image:
name: Swift image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Swift image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: swift
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.SWIFT_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
SWIFT_VERSION=${{ env.SWIFT_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
bazel_image:
name: Bazel image
needs: [ base_image ]
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build Bazel image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: bazel
token: ${{ secrets.GITHUB_TOKEN }}
version: "${{ env.BAZEL_VERSION }}"
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
build-args: |
BAZEL_VERSION=${{ env.BAZEL_VERSION }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
ort_version:
name: Get Ort Version
runs-on: ubuntu-22.04
outputs:
ort_version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: get_version
run: |
ORT_VERSION=$(./gradlew --no-configure-on-demand -q properties --property version | sed -nr "s/version: (.+)/\1/p")
echo "version=${ORT_VERSION}" >> $GITHUB_OUTPUT
echo "Current ORT Version: $ORT_VERSION"
shell: bash
# Minimal Runtime ORT image
# -------------------------
minimal_image:
needs:
[ ort_version, base_image, nodejs_image, python_image, rust_image, ruby_image, golang_image ]
name: Build ORT minimal image
runs-on: ubuntu-22.04
outputs:
image_version: ${{ steps.image.outputs.image_version }}
permissions:
contents: read
packages: write
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Build ORT minimal image
id: image
uses: heliocastro/docker-build-control@v3
with:
name: ort-minimal
target: minimal
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ needs.ort_version.outputs.ort_version }}
invalidate-cache: ${{ inputs.invalidate-cache }}
debug: ${{ inputs.debug }}
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-minimal
build-args: |
NODEJS_VERSION=${{ env.NODEJS_VERSION }}
ORT_VERSION=${{ needs.ort_version.outputs.ort_version }}
build-contexts: |
base=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/base:${{ needs.base_image.outputs.image_version }}
nodejs=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/nodejs:${{ needs.nodejs_image.outputs.image_version }}
python=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/python:${{ needs.python_image.outputs.image_version }}
rust=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/rust:${{ needs.rust_image.outputs.image_version }}
ruby=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/ruby:${{ needs.ruby_image.outputs.image_version }}
golang=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/golang:${{ needs.golang_image.outputs.image_version }}
# Full Runtime ORT image
# ----------------------
ort_image:
name: Build ORT image
needs:
[ ort_version, minimal_image, android_image, dart_image, dotnet_image, haskell_image, scala_image, swift_image, bazel_image ]
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout default branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker build
uses: docker/setup-buildx-action@v3
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract components metadata (tags, labels)
id: meta-ort
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/ort
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=schedule,pattern=snapshot
type=pep440,pattern={{version}}
type=raw,value=${{ needs.ort_version.outputs.ort_version }}
type=ref,event=tag
- name: Build ORT image
uses: docker/build-push-action@v5
with:
context: .
target: run
push: true
load: false
tags: |
${{ steps.meta-ort.outputs.tags }}
labels: ${{ steps.meta-ort.outputs.labels }}
build-contexts: |
minimal=docker-image://${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-minimal:${{ needs.ort_version.outputs.ort_version }}
android=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/android:${{ needs.android_image.outputs.image_version }}
swift=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/swift:${{ needs.swift_image.outputs.image_version }}
scala=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/scala:${{ needs.scala_image.outputs.image_version }}
dart=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dart:${{ needs.dart_image.outputs.image_version }}
dotnet=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/dotnet:${{ needs.dotnet_image.outputs.image_version }}
haskell=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/haskell:${{ needs.haskell_image.outputs.image_version }}
bazel=docker-image://${{ env.REGISTRY }}/${{ github.repository }}/bazel:${{ needs.bazel_image.outputs.image_version }}
funTest-docker:
needs: [ ort_image, ort_version ]
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/ort:${{ needs.ort_version.outputs.ort_version }}
options: --user 1001
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run functional tests that do require external tools
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true
arguments: --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport
- name: Upload code coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: funTest-docker