Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Try different apt-get mirrors in CI (#13082)

Alex Crichton6734861012f6
diff --git a/.github/actions/apt-get-install/action.yml b/.github/actions/apt-get-install/action.yml
new file mode 100644
index 0000000000..1659482de6
--- /dev/null
+++ b/.github/actions/apt-get-install/action.yml
@@ -0,0 +1,40 @@
+name: "Run apt-get to install packages"
+description: "Helper to work around some common github actions issues"
+
+inputs:
+ packages:
+ description: "The packages to install with apt-get"
+ required: true
+ default: ""
+
+runs:
+ using: composite
+ steps:
+ # See https://github.com/actions/runner-images/issues/12949 and
+ # https://github.com/actions/runner-images/issues/7048 for some background,
+ # but the default mirrors can sometimes take up to 30+ minutes to install a
+ # package. Seems like the azure mirrors are heavily throttled occasionally.
+ # Ideally something like
+ # https://github.com/marketplace/actions/configure-fast-apt-mirror would be
+ # used to figure out the fastest mirror but in the interest of trying out
+ # something simple we instead just tweak some priorities.
+ #
+ # This is lifted from
+ # https://github.com/servo/servo/blob/main/.github/actions/apt-mirrors/action.yml
+ # which is in turn lifted from
+ # https://github.com/CrowdStrike/glide-core/pull/1113 apparently.
+ - name: Change Mirror Priorities
+ shell: bash
+ run: |
+ sudo sed -i '/archive.ubuntu.com\/ubuntu\/\tpriority/ s/priority:2/priority:0/' /etc/apt/apt-mirrors.txt
+ sudo sed -i '/azure.archive.ubuntu.com\/ubuntu\/\tpriority/ s/priority:0/priority:1/' /etc/apt/apt-mirrors.txt
+ sudo sed -i '/security.ubuntu.com\/ubuntu\/\tpriority/ s/priority:3/priority:2/' /etc/apt/apt-mirrors.txt
+ sudo cat /etc/apt/apt-mirrors.txt
+
+ - name: Update apt-get
+ shell: bash
+ run: sudo apt-get update
+
+ - name: Install packages
+ shell: bash
+ run: sudo apt-get install -y ${{ inputs.packages }}
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 8d122685af..9d81237a9b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -616,9 +616,10 @@ jobs:
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cross
if: ${{ matrix.cross }}
- - name: Install apt packages
+ - uses: ./.github/actions/apt-get-install
if: ${{ matrix.apt_packages }}
- run: sudo apt-get update && sudo apt-get install -y ${{ matrix.apt_packages }}
+ with:
+ packages: ${{ matrix.apt_packages }}
- run: ${{ matrix.test }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
@@ -660,7 +661,9 @@ jobs:
# Install the OCaml packages necessary for fuzz targets that use the
# `wasm-spec-interpreter`.
- run: cargo install cargo-fuzz --vers "^0.11" --locked
- - run: sudo apt-get update && sudo apt install -y ocaml-nox ocamlbuild ocaml-findlib libzarith-ocaml-dev
+ - uses: ./.github/actions/apt-get-install
+ with:
+ packages: ocaml-nox ocamlbuild ocaml-findlib libzarith-ocaml-dev
- run: cargo fetch
working-directory: ./fuzz
- run: cargo fuzz check --dev
@@ -796,15 +799,16 @@ jobs:
- run: cargo fetch --locked
- - name: Install cross-compilation tools
- run: |
- set -ex
-
- sudo apt-get update
- sudo apt-get install -y ${{ matrix.gcc_package }}
+ - uses: ./.github/actions/apt-get-install
+ name: Install cross-compilation tools
+ if: matrix.gcc_package != ''
+ with:
+ packages: ${{ matrix.gcc_package }}
- # Configure Cargo for cross compilation and tell it how it can run
- # cross executables
+ # Configure Cargo for cross compilation and tell it how it can run
+ # cross executables
+ - name: Configure cross-compilation tools
+ run: |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
if: matrix.gcc != ''
@@ -1053,8 +1057,10 @@ jobs:
curl --retry 5 --retry-all-errors -OL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-x86_64-linux.tar.gz
tar -xzf wasi-sdk-30.0-x86_64-linux.tar.gz
mv wasi-sdk-30.0-x86_64-linux wasi-sdk
+ - uses: ./.github/actions/apt-get-install
+ with:
+ packages: gdb lldb-18 llvm
- run: |
- sudo apt-get update && sudo apt-get install -y gdb lldb-18 llvm
# workaround for https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855
sudo mkdir -p /usr/lib/local/lib/python3.10/dist-packages/lldb
sudo ln -s /usr/lib/llvm-15/lib/python3.10/dist-packages/lldb/* /usr/lib/python3/dist-packages/lldb/