From 14087cbb72509e0cae8df1d21eb23c4ae9974b68 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Fri, 30 Aug 2024 13:41:22 +0200 Subject: [PATCH] feat: Update Ubuntu to 24.04 (noble) Github started to provide runners with the latest Ubuntu, which allows update the current Docker and workflows. Swift SDK is updated to the new 10.x stable release as the first to use current Ubuntu LTS. New Ubuntu default Docker image uses GID 1000 to ubuntu user, therefore ort user is now using GID 1001. Signed-off-by: Helio Chissini de Castro --- .github/actions/free-disk-space/action.yml | 16 +- .github/workflows/build-and-test.yml | 224 +++++++++++---------- .github/workflows/docker-build.yml | 10 +- .github/workflows/release.yml | 2 +- .github/workflows/scorecard-analysis.yml | 2 +- .github/workflows/static-analysis.yml | 16 +- .github/workflows/website-deploy.yml | 4 +- .github/workflows/website-test.yml | 2 +- .github/workflows/wrapper-validation.yml | 2 +- Dockerfile | 6 +- NOTICE | 1 + docker/versions.dockerfile | 4 +- 12 files changed, 160 insertions(+), 129 deletions(-) diff --git a/.github/actions/free-disk-space/action.yml b/.github/actions/free-disk-space/action.yml index 08da64630ee00..f8bc91e7b061f 100644 --- a/.github/actions/free-disk-space/action.yml +++ b/.github/actions/free-disk-space/action.yml @@ -16,9 +16,15 @@ # License-Filename: LICENSE name: "Free Disk Space" -description: "Remove unneeded preinstalled Docker images and software to free disk space." +description: "Remove uneeded preinstalled Docker images and software to free disk space." author: "The ORT Project Authors" +inputs: + clean: + default: "false" + description: "Enable cleanup tasks. Defaults to false." + required: false + runs: using: "composite" @@ -27,10 +33,11 @@ runs: shell: bash run: df -h - name: List Docker Images - if: ${{ false }} # Can be enabled if the 'Remove Unneeded Docker Images' step below needs to be updated. + if: ${{ github.event.inputs.clean == 'true' }} shell: bash run: docker images - name: Remove Unneeded Docker Images + if: ${{ github.event.inputs.clean == 'true' }} shell: bash run: | docker image rm \ @@ -43,12 +50,13 @@ runs: debian:10 \ debian:11 \ ubuntu:20.04 \ - ubuntu:22.04 + ubuntu:22.04 \ + ubuntu:24.04 - name: Print Disk Space shell: bash run: df -h - name: Get Size of Installed Tools - if: ${{ false }} # Can be enabled if the 'Remove Unneeded Tools' step below needs to be updated. + if: ${{ github.event.inputs.clean == 'true' }} shell: bash run: | sudo du -hsc /usr/lib/* diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d357092bce413..8039b62bebd85 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -7,6 +7,12 @@ on: push: branches: - main + workflow_dispatch: + inputs: + clean: + description: "Free disk space cleaning leftovers." + required: true + type: boolean env: GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotest.assertions.multi-line-diff=unified -Dkotest.tags=!ExpensiveTag @@ -15,65 +21,65 @@ env: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - - name: Build all classes - run: ./gradlew classes + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - name: Build all classes + run: ./gradlew classes codeql-analysis: needs: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: # Needed for SARIF scanning upload. security-events: write steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 - with: - languages: java - - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - - name: Build all classes - run: ./gradlew -Dorg.gradle.jvmargs=-Xmx1g classes - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 + with: + languages: java + - name: Setup Gradle + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - name: Build all classes + run: ./gradlew -Dorg.gradle.jvmargs=-Xmx1g classes + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 test: needs: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - - name: Run unit tests - run: ./gradlew --scan test jacocoTestReport - - name: Create Test Summary - uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 - with: - paths: "**/test-results/**/TEST-*.xml" - if: always() - - name: Upload code coverage data - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: test + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - name: Run unit tests + run: ./gradlew --scan test jacocoTestReport + - name: Create Test Summary + uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 + with: + paths: "**/test-results/**/TEST-*.xml" + if: always() + - name: Upload code coverage data + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: test funTest-non-docker: needs: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - submodules: recursive - - name: Set tool version environment variables - run: sed "s/^ARG //" docker/versions.dockerfile >> $GITHUB_ENV - - name: Install required tools - run: | + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + submodules: recursive + - name: Set tool version environment variables + run: sed "s/^ARG //" docker/versions.dockerfile >> $GITHUB_ENV + - name: Install required tools + run: | # Uninstall mono-devel because it contains the "lc" command which conflicts with BoyterLc. sudo apt-get -qq remove mono-devel @@ -94,65 +100,73 @@ jobs: echo "gem: --bindir $HOME/.local/bin" > $HOME/.gemrc gem install --user-install licensee -v $LICENSEE_VERSION - # Install ScanCode for license texts. + # Download scancode requirements. curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt - pip install --no-cache-dir --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION - - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - - name: Run functional tests that do not require external tools - run: ./gradlew --scan -Ptests.exclude=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport - - name: Create Test Summary - uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 - with: - paths: "**/test-results/**/TEST-*.xml" - if: always() - - name: Upload code coverage data - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: funTest-non-docker + - name: Setup Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: pip + - run: pip install --no-cache-dir --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION + - name: Setup Gradle + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - name: Run functional tests that do not require external tools + run: ./gradlew --scan -Ptests.exclude=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport + - name: Create Test Summary + uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 + with: + paths: "**/test-results/**/TEST-*.xml" + if: always() + - name: Upload code coverage data + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: funTest-non-docker funTest-docker: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - submodules: recursive - - name: Free Disk Space - uses: ./.github/actions/free-disk-space - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 - - name: Build ORT Docker Image - uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 - with: - context: . - load: true - tags: ${{ env.TEST_IMAGE_TAG }} - target: all-tools - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache - - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - - name: Run functional tests that do require external tools - run: | - # Run the functional tests in the Docker container. - docker run \ - -u $(id -u):$(id -g) \ - -v /etc/group:/etc/group:ro \ - -v /etc/passwd:/etc/passwd:ro \ - -v /home/runner:/home/runner \ - -v ${{ github.workspace }}:/workspace \ - -w /workspace \ - -e HOME=/home/runner \ - -e GRADLE_OPTS="$GRADLE_OPTS" \ - ${{ env.TEST_IMAGE_TAG }} \ - -c "./gradlew --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport" - - name: Create Test Summary - uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 - with: - paths: "**/test-results/**/TEST-*.xml" - if: always() - - name: Upload code coverage data - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: funTest-docker + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + submodules: recursive + - name: Free Disk Space + if: ${{ inputs.clean }} + uses: ./.github/actions/free-disk-space + with: + clean: "true" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 + - name: Build ORT Docker Image + uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6 + with: + context: . + load: true + tags: ${{ env.TEST_IMAGE_TAG }} + target: all-tools + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/ort:cache + - name: Setup Gradle + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - name: Run functional tests that do require external tools + run: | + # Run the functional tests in the Docker container. + docker run \ + -u $(id -u):$(id -g) \ + -v /etc/group:/etc/group:ro \ + -v /etc/passwd:/etc/passwd:ro \ + -v /home/runner:/home/runner \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + -e HOME=/home/runner \ + -e GRADLE_OPTS="$GRADLE_OPTS" \ + ${{ env.TEST_IMAGE_TAG }} \ + -c "./gradlew --scan -Ptests.include=org.ossreviewtoolkit.plugins.packagemanagers.* funTest jacocoFunTestReport" + - name: Create Test Summary + uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2 + with: + paths: "**/test-results/**/TEST-*.xml" + if: always() + - name: Upload code coverage data + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: funTest-docker diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 16ea5a034f398..c967501f5981e 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -10,6 +10,11 @@ on: tags: - "[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: + inputs: + clean: + description: "Free disk space cleaning leftovers." + required: true + type: boolean env: GRADLE_OPTS: -Dorg.gradle.daemon=false @@ -18,14 +23,17 @@ env: jobs: disk_space: name: Docker Build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 0 - name: Free Disk Space + if: ${{ inputs.clean }} uses: ./.github/actions/free-disk-space + with: + clean: "true" - name: Setup Gradle uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - name: Get ORT version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c1a8fad33281..ea9a4ea460042 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: attestations: write contents: write id-token: write - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 diff --git a/.github/workflows/scorecard-analysis.yml b/.github/workflows/scorecard-analysis.yml index 3a445ea8d1969..a75b00d7e44ed 100644 --- a/.github/workflows/scorecard-analysis.yml +++ b/.github/workflows/scorecard-analysis.yml @@ -12,7 +12,7 @@ permissions: read-all jobs: scorecard-analysis: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: # Needed for SARIF scanning upload. security-events: write diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c59d4398a8b26..412e7829e71fc 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,7 +13,7 @@ env: jobs: commit-lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 @@ -24,7 +24,7 @@ jobs: with: configFile: .commitlintrc.yml code-base-checks: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 @@ -33,7 +33,7 @@ jobs: - name: Check copyrights, license headers, and .gitattributes run: ./gradlew checkCopyrightsInNoticeFile checkLicenseHeaders checkGitAttributes completions: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 @@ -59,7 +59,7 @@ jobs: exit 1 fi detekt-issues: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: # Needed for SARIF scanning upload. security-events: write @@ -76,7 +76,7 @@ jobs: with: sarif_file: build/reports/detekt/merged.sarif markdown-links: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 @@ -88,7 +88,7 @@ jobs: max-depth: 2 use-quiet-mode: yes markdownlint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 @@ -102,7 +102,7 @@ jobs: npx markdownlint-cli2 qodana-scan: if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: # Needed for SARIF scanning upload. security-events: write @@ -121,7 +121,7 @@ jobs: with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json reuse-tool: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index de8bc607d71e0..88d13ba716eb2 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -8,7 +8,7 @@ on: jobs: build: name: Website Build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 @@ -34,6 +34,6 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 diff --git a/.github/workflows/website-test.yml b/.github/workflows/website-test.yml index e525c0aa33574..e633df93eced5 100644 --- a/.github/workflows/website-test.yml +++ b/.github/workflows/website-test.yml @@ -8,7 +8,7 @@ on: jobs: test: name: Website Test - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 diff --git a/.github/workflows/wrapper-validation.yml b/.github/workflows/wrapper-validation.yml index c03b93763e987..7205096d52eda 100644 --- a/.github/workflows/wrapper-validation.yml +++ b/.github/workflows/wrapper-validation.yml @@ -10,7 +10,7 @@ on: jobs: gradle-wrapper: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 diff --git a/Dockerfile b/Dockerfile index 78896dddf1b48..93df3478b0b40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -75,7 +75,7 @@ RUN echo $LANG > /etc/locale.gen \ && update-locale LANG=$LANG ARG USERNAME=ort -ARG USER_ID=1000 +ARG USER_ID=1001 ARG USER_GID=$USER_ID ARG HOMEDIR=/home/ort ENV HOME=$HOMEDIR @@ -361,9 +361,9 @@ ENV PATH=$PATH:$SWIFT_HOME/bin RUN mkdir -p $SWIFT_HOME \ && echo $SWIFT_VERSION \ && if [ "$(arch)" = "aarch64" ]; then \ - SWIFT_PACKAGE="ubuntu2204-aarch64/swift-$SWIFT_VERSION-RELEASE/swift-$SWIFT_VERSION-RELEASE-ubuntu22.04-aarch64.tar.gz"; \ + SWIFT_PACKAGE="ubuntu2404-aarch64/swift-$SWIFT_VERSION-RELEASE/swift-$SWIFT_VERSION-RELEASE-ubuntu24.04-aarch64.tar.gz"; \ else \ - SWIFT_PACKAGE="ubuntu2204/swift-$SWIFT_VERSION-RELEASE/swift-$SWIFT_VERSION-RELEASE-ubuntu22.04.tar.gz"; \ + SWIFT_PACKAGE="ubuntu2404/swift-$SWIFT_VERSION-RELEASE/swift-$SWIFT_VERSION-RELEASE-ubuntu24.04.tar.gz"; \ fi \ && curl -L https://download.swift.org/swift-$SWIFT_VERSION-release/$SWIFT_PACKAGE \ | tar -xz -C $SWIFT_HOME --strip-components=2 diff --git a/NOTICE b/NOTICE index 49cf104af1aad..f8f5351234fa9 100644 --- a/NOTICE +++ b/NOTICE @@ -16,3 +16,4 @@ Copyright (C) 2022 Google, LLC Copyright (C) 2022-2024 EPAM Systems, Inc. Copyright (C) 2023-2024 Double Open Oy Copyright (C) 2024 Robert Bosch GmbH +Copyright (C) 2024 Cariad SE diff --git a/docker/versions.dockerfile b/docker/versions.dockerfile index 35d5fc307f918..dcd74d0a3e7ac 100644 --- a/docker/versions.dockerfile +++ b/docker/versions.dockerfile @@ -27,6 +27,6 @@ ARG RUBY_VERSION=3.1.2 ARG RUST_VERSION=1.72.0 ARG SBT_VERSION=1.10.0 ARG SCANCODE_VERSION=32.2.1 -ARG SWIFT_VERSION=5.9.2 -ARG UBUNTU_VERSION=jammy +ARG SWIFT_VERSION=5.10.1 +ARG UBUNTU_VERSION=noble ARG YARN_VERSION=1.22.19