7171 # see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available
7272 python_version : [ '3.10' ]
7373 runs-on : ${{ matrix.os }}
74- container : ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }} # Use the Ubuntu 20.04 container inside Ubuntu 22.04 runner to build
74+ container : ${{ (startsWith( matrix.os, 'ubuntu') && 'ubuntu:20.04') || null }} # Use the Ubuntu 20.04 container inside Ubuntu 22.04 runner to build
7575 steps :
7676 - uses : actions/checkout@v4
7777 - name : Read the mozilla-central commit hash to be used
@@ -84,14 +84,43 @@ jobs:
8484 ./_spidermonkey_install/*
8585 key : spidermonkey-${{ env.MOZCENTRAL_VERSION }}-${{ runner.os }}-${{ runner.arch }}
8686 - name : Setup container
87- if : ${{ matrix.os == 'ubuntu-22.04' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
87+ if : ${{ startsWith( matrix.os, 'ubuntu') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
8888 run : |
8989 apt-get update -y
9090 apt-get install -y sudo libnss3-dev libssl-dev
91+ apt-get install -y curl make git build-essential
92+ apt-get install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev # required for pyenv
9193 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
9294 echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04
95+ - name : Setup LLVM
96+ if : ${{ startsWith(matrix.os, 'ubuntu') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
97+ run : |
98+ apt-get install -y llvm clang
99+ apt-get install -y lsb-release wget software-properties-common gnupg
100+ wget https://apt.llvm.org/llvm.sh
101+ chmod +x llvm.sh
102+ ./llvm.sh 18 # install LLVM version 18
103+ update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-18 18
104+ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 18
105+ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 18
106+ clang --version
107+ clang++ --version
108+ - name : Setup Python
109+ if : ${{ startsWith(matrix.os, 'ubuntu') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
110+ run : |
111+ # Use pyenv to install Python version that is not available via `actions/setup-python`
112+ unset PYENV_ROOT
113+ curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
114+ echo "$HOME/.pyenv/bin" >> $GITHUB_PATH # ~/.bashrc file is not read, so we need to add to GITHUB_PATH manually
115+ echo "$HOME/.pyenv/shims" >> $GITHUB_PATH
116+ echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
117+ export PATH="$HOME/.pyenv/bin:$PATH"
118+ pyenv install $PYTHON_VERSION
119+ pyenv global $PYTHON_VERSION
120+ env :
121+ PYTHON_VERSION : ${{ matrix.python_version }}
93122 - uses : actions/setup-python@v5
94- if : ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
123+ if : ${{ !startsWith(matrix.os, 'ubuntu') && steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
95124 with :
96125 python-version : ${{ matrix.python_version }}
97126 - name : Setup XCode
@@ -154,13 +183,14 @@ jobs:
154183 os : [ 'ubuntu-22.04', 'macos-13', 'macos-14', 'windows-2022', 'ubuntu-22.04-arm' ]
155184 python_version : [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
156185 runs-on : ${{ matrix.os }}
157- container : ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }}
186+ container : ${{ (startsWith( matrix.os, 'ubuntu') && 'ubuntu:20.04') || null }}
158187 steps :
159188 - name : Setup container
160- if : ${{ matrix.os == 'ubuntu-22.04' }}
189+ if : ${{ startsWith( matrix.os, 'ubuntu') }}
161190 run : |
162191 apt-get update -y
163192 apt-get install -y sudo libnss3-dev libssl-dev
193+ apt-get install -y curl zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev # required for pyenv
164194 apt-get install -y git # required for `actions/checkout`
165195 apt-get install -y nodejs npm # required for pminit to build
166196 apt-get install -y build-essential
@@ -179,7 +209,22 @@ jobs:
179209 submodules : recursive
180210 fetch-depth : 0 # fetch all history for all branches and tags
181211 # poetry-dynamic-versioning needs git tags to produce the correct version number
212+ - name : Setup Python
213+ if : ${{ startsWith(matrix.os, 'ubuntu') }}
214+ run : |
215+ # Use pyenv to install Python version that is not available via `actions/setup-python`
216+ unset PYENV_ROOT
217+ curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
218+ echo "$HOME/.pyenv/bin" >> $GITHUB_PATH # ~/.bashrc file is not read, so we need to add to GITHUB_PATH manually
219+ echo "$HOME/.pyenv/shims" >> $GITHUB_PATH
220+ echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
221+ export PATH="$HOME/.pyenv/bin:$PATH"
222+ pyenv install $PYTHON_VERSION
223+ pyenv global $PYTHON_VERSION
224+ env :
225+ PYTHON_VERSION : ${{ matrix.python_version }}
182226 - uses : actions/setup-python@v5
227+ if : ${{ !startsWith(matrix.os, 'ubuntu') }}
183228 with :
184229 python-version : ${{ matrix.python_version }}
185230 - name : Setup Poetry
0 commit comments