From b01e0abcf8bcc079f8f15304968d272b38c0c314 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Sun, 21 Aug 2022 23:13:44 -0700 Subject: [PATCH 1/4] Update LINUX_CI_OS_VERSION and related constants - Change `LINUX_CI_OS_VERSION` from `Ubuntu 16.04` to `Ubuntu 22.04` - Change `LINUX_GLIBC_CI_VERSION` from `2.23` to `2.35` - Change `LINUX_GCC_CI_VERSION` from `5.0` to `11.0` - Change `LINUX_PREFERRED_GCC_FORMULA` from `gcc@5` to `gcc@11` - Build the Docker image `ghcr.io/homebrew/ubuntu22.04:master` --- .github/workflows/tests.yml | 10 +++++----- Library/Homebrew/os.rb | 13 +++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab09dcac66..e4ce84ba35 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -174,19 +174,19 @@ jobs: uses: Homebrew/actions/setup-homebrew@master - name: Build Docker image - run: docker build -t brew --build-arg=version=16.04 . + run: docker build -t brew --build-arg=version=22.04 . - name: Deploy the Docker image to GitHub Packages and Docker Hub if: github.ref == 'refs/heads/master' run: | echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin - docker tag brew "ghcr.io/homebrew/ubuntu16.04:master" - docker push "ghcr.io/homebrew/ubuntu16.04:master" + docker tag brew "ghcr.io/homebrew/ubuntu22.04:master" + docker push "ghcr.io/homebrew/ubuntu22.04:master" echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin - docker tag brew "homebrew/ubuntu16.04:master" - docker push "homebrew/ubuntu16.04:master" + docker tag brew "homebrew/ubuntu22.04:master" + docker push "homebrew/ubuntu22.04:master" tests: name: ${{ matrix.name }} diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index ac480c374f..0fc42af698 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -45,15 +45,12 @@ module OS ::OS_VERSION = ENV.fetch("HOMEBREW_OS_VERSION").freeze - LINUX_CI_OS_VERSION = "Ubuntu 16.04" - LINUX_GLIBC_CI_VERSION = "2.23" - LINUX_GCC_CI_VERSION = "5.0" - LINUX_PREFERRED_GCC_FORMULA = "gcc@5" - - # Ubuntu 22.04 (see Linux-CI.md) + # See Linux-CI.md + LINUX_CI_OS_VERSION = "Ubuntu 22.04" + LINUX_GLIBC_CI_VERSION = "2.35" LINUX_GLIBC_NEXT_CI_VERSION = "2.35" - # LINUX_GCC_CI_VERSION = "11.0" - # LINUX_PREFERRED_GCC_FORMULA = "gcc@11" + LINUX_GCC_CI_VERSION = "11.0" + LINUX_PREFERRED_GCC_FORMULA = "gcc@11" if OS.mac? require "os/mac" From b9e1a51266a09af7e2bb9f93e464ae0f9584942c Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 24 Aug 2022 17:05:10 -0700 Subject: [PATCH 2/4] test: Update tests that mock gcc@5 --- Library/Homebrew/test/compiler_selector_spec.rb | 6 +++--- Library/Homebrew/test/formula_installer_bottle_spec.rb | 2 +- Library/Homebrew/test/formulary_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/test/compiler_selector_spec.rb b/Library/Homebrew/test/compiler_selector_spec.rb index 5ee6d0c2eb..afedc9d8b1 100644 --- a/Library/Homebrew/test/compiler_selector_spec.rb +++ b/Library/Homebrew/test/compiler_selector_spec.rb @@ -52,7 +52,7 @@ describe CompilerSelector do it "returns gcc-5 if gcc formula offers gcc-5 on linux", :needs_linux do software_spec.fails_with(:clang) - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-5") end @@ -60,14 +60,14 @@ describe CompilerSelector do software_spec.fails_with(:clang) software_spec.fails_with(gcc: "5") software_spec.fails_with(gcc: "7") - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-6") end it "returns gcc-7 if gcc formula offers gcc-5 and fails with gcc <= 6 on linux", :needs_linux do software_spec.fails_with(:clang) software_spec.fails_with(:gcc) { version "6" } - allow(Formulary).to receive(:factory).with("gcc@5").and_return(double(version: Version.new("5.0"))) + allow(Formulary).to receive(:factory).with("gcc@11").and_return(double(version: Version.new("5.0"))) expect(selector.compiler).to eq("gcc-7") end diff --git a/Library/Homebrew/test/formula_installer_bottle_spec.rb b/Library/Homebrew/test/formula_installer_bottle_spec.rb index 143fc03dcf..1cc7037b93 100644 --- a/Library/Homebrew/test/formula_installer_bottle_spec.rb +++ b/Library/Homebrew/test/formula_installer_bottle_spec.rb @@ -24,7 +24,7 @@ describe FormulaInstaller do stub_formula_loader formula stub_formula_loader formula("gcc") { url "gcc-1.0" } - stub_formula_loader formula("gcc@5") { url "gcc-5.0" } + stub_formula_loader formula("gcc@11") { url "gcc-11.0" } fi = FormulaInstaller.new(formula) fi.fetch diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 0fc043fe6b..03fe46e6ab 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -142,7 +142,7 @@ describe Formulary do before do allow(described_class).to receive(:loader_for).and_call_original stub_formula_loader formula("gcc") { url "gcc-1.0" } - stub_formula_loader formula("gcc@5") { url "gcc-5.0" } + stub_formula_loader formula("gcc@11") { url "gcc-11.0" } end let(:installed_formula) { described_class.factory(formula_path) } From 0de42825117801371a094b45e30cf14910f673f8 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 31 Aug 2022 11:01:59 -0700 Subject: [PATCH 3/4] CI: Use ubuntu-22.04 rather than ubuntu-latest (ubuntu-20.04) Use ubuntu-22.04 for the CI tests rather than ubuntu-latest, which is currently ubuntu-20.04. --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker.yml | 2 +- .github/workflows/maintainers-man-completions.yml | 2 +- .github/workflows/spdx.yml | 2 +- .github/workflows/tests.yml | 12 ++++++------ .github/workflows/triage-issues.yml | 6 +++--- .github/workflows/triage.yml | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 371605a34f..0026c0d168 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,7 +11,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: actions: read contents: read diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8bdfb1f8db..1d692b3838 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,7 +14,7 @@ permissions: jobs: ubuntu: if: startsWith(github.repository, 'Homebrew/') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/.github/workflows/maintainers-man-completions.yml b/.github/workflows/maintainers-man-completions.yml index b01c18bfc6..893f4dcb27 100644 --- a/.github/workflows/maintainers-man-completions.yml +++ b/.github/workflows/maintainers-man-completions.yml @@ -21,7 +21,7 @@ permissions: jobs: updates: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.repository == 'Homebrew/brew' steps: - name: Setup Homebrew diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml index 57e004500e..444ca4d001 100644 --- a/.github/workflows/spdx.yml +++ b/.github/workflows/spdx.yml @@ -15,7 +15,7 @@ permissions: jobs: spdx: if: github.repository == 'Homebrew/brew' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4ce84ba35..4429640597 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ concurrency: jobs: syntax: if: github.repository == 'Homebrew/brew' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -52,7 +52,7 @@ jobs: name: tap syntax (Linux) needs: syntax if: startsWith(github.repository, 'Homebrew/') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -146,7 +146,7 @@ jobs: vendored-gems: name: vendored gems (Linux) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -167,7 +167,7 @@ jobs: docker: needs: syntax - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set up Homebrew id: set-up-homebrew @@ -191,7 +191,7 @@ jobs: tests: name: ${{ matrix.name }} needs: syntax - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: include: @@ -244,7 +244,7 @@ jobs: test-default-formula-linux: name: test default formula (Linux) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: HOMEBREW_BOOTSNAP: 1 steps: diff --git a/.github/workflows/triage-issues.yml b/.github/workflows/triage-issues.yml index 7963be2688..93b7411565 100644 --- a/.github/workflows/triage-issues.yml +++ b/.github/workflows/triage-issues.yml @@ -29,7 +29,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'stale') ) ) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Mark/Close Stale Issues and Pull Requests uses: actions/stale@v5 @@ -55,7 +55,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'stale') ) ) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Mark/Close Stale `bump-formula-pr` and `bump-cask-pr` Pull Requests uses: actions/stale@v5 @@ -72,7 +72,7 @@ jobs: lock-threads: if: startsWith(github.repository, 'Homebrew/') && github.event_name != 'issue_comment' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Lock Outdated Threads uses: dessant/lock-threads@e460dfeb36e731f3aeb214be6b0c9a9d9a67eda6 diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 2ef2939e34..1b21dbc19f 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -18,7 +18,7 @@ concurrency: triage-${{ github.head_ref }} jobs: review: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: startsWith(github.repository, 'Homebrew/') steps: - name: Re-run this workflow From aa5f6a7ccd9b7a07b0f57b54c10db5257d32bce3 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 1 Sep 2022 12:21:30 -0700 Subject: [PATCH 4/4] Fix test/unpack_strategy/zstd for Ubuntu 22.04 --- Library/Homebrew/test/unpack_strategy/zstd_spec.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/unpack_strategy/zstd_spec.rb b/Library/Homebrew/test/unpack_strategy/zstd_spec.rb index 6e9198b996..270db9ce40 100644 --- a/Library/Homebrew/test/unpack_strategy/zstd_spec.rb +++ b/Library/Homebrew/test/unpack_strategy/zstd_spec.rb @@ -6,5 +6,12 @@ require_relative "shared_examples" describe UnpackStrategy::Zstd do let(:path) { TEST_FIXTURE_DIR/"cask/container.tar.zst" } - include_examples "UnpackStrategy::detect" + it "is correctly detected" do + # UnpackStrategy.detect(path) for a .tar.XXX file returns either UnpackStrategy::Tar if + # the host's tar is able to extract that compressed file or UnpackStrategy::XXX otherwise, + # such as UnpackStrategy::Zstd. On macOS UnpackStrategy.detect("container.tar.zst") + # returns UnpackStrategy::Zstd, and on ubuntu-22.04 it returns UnpackStrategy::Tar, + # because the host's version of tar is recent enough and zstd is installed. + expect(UnpackStrategy.detect(path)).to(be_a(described_class).or(be_a(UnpackStrategy::Tar))) + end end