fix: Install proper libraries for x86 Linux #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-build | |
on: | |
pull_request: | |
branches: | |
- master | |
- develop | |
- feature/** | |
push: | |
branches: | |
- master | |
- develop | |
- feature/** | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
release: | |
types: published | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} | |
cancel-in-progress: true | |
env: | |
NINJA_BASE_URL: https://github.com/ninja-build/ninja/releases/download/ | |
jobs: | |
posix: | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- slug: linux-i386 | |
cc: gcc | |
cxx: g++ | |
cflags: "-m32" | |
ldflags: "-m32" | |
libflags: "-m32" | |
os: ubuntu-20.04 | |
# https://github.com/actions/runner-images/issues/2324#issuecomment-749985726 | |
install: "libc6-dev:i386 libx11-dev:i386 libxext-dev:i386 lib32gcc-7-dev gcc-multilib" | |
ninja_release_name: v1.11.1/ninja-linux.zip | |
- slug: linux-amd64 | |
cc: gcc | |
cxx: g++ | |
cflags: "-m64" | |
ldflags: "-m64" | |
libflags: "-m64" | |
os: ubuntu-20.04 | |
ninja_release_name: v1.11.1/ninja-linux.zip | |
- slug: macos-amd64 | |
gen_args: "--use-lto --use-icf" | |
cc: clang | |
cxx: clang++ | |
cflags: "-m64" | |
ldflags: "-m64" | |
libflags: "-m64" | |
os: macos-12 | |
ninja_release_name: v1.11.1/ninja-mac.zip | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install packages | |
if: matrix.install | |
run: sudo apt install ${{ matrix.install }} | |
- uses: actions/checkout@v4 | |
with: | |
# we need all everything for `git describe` to work correctly | |
fetch-depth: 0 | |
- name: Make dependencies directory | |
run: | | |
DEPS_DIR=$(cd ~; pwd)/deps | |
mkdir -p ${DEPS_DIR} | |
echo "export DEPS_DIR=$DEPS_DIR" >> "${GITHUB_WORKSPACE}/.env" | |
- name: Install recent Ninja | |
run: | | |
source .env | |
cd ${DEPS_DIR} | |
wget --no-check-certificate --quiet -O ninja.zip "${NINJA_BASE_URL}${{ matrix.ninja_release_name }}" | |
python -c 'import sys,zipfile;zipfile.ZipFile(sys.argv[1]).extractall()' ninja.zip | |
chmod +x ninja | |
- name: Setup compiler environment | |
run: | | |
echo 'export CC="${{ matrix.cc }}"' >> "${GITHUB_WORKSPACE}/.env" | |
echo 'export CXX="${{ matrix.cxx }}"' >> "${GITHUB_WORKSPACE}/.env" | |
echo 'export CFLAGS="${{ matrix.cflags }}"' >> "${GITHUB_WORKSPACE}/.env" | |
echo 'export LDFLAGS="${{ matrix.ldflags }}"' >> "${GITHUB_WORKSPACE}/.env" | |
echo 'export LIBFLAGS="${{ matrix.libflags }}"' >> "${GITHUB_WORKSPACE}/.env" | |
- name: Cache libc++ and libc++abi if needed | |
if: "${{ matrix.cc == 'clang' }}" | |
uses: actions/cache@v3 | |
with: | |
path: ~/deps/llvm | |
key: ${{ runner.os }}-llvm-${{ matrix.slug }} | |
- name: Show final environment | |
run: | | |
cat .env | |
- name: Compile | |
run: | | |
source .env | |
build/gen.py ${{ matrix.gen_args }} | |
${DEPS_DIR}/ninja -C out | |
- name: Run tests | |
run: | | |
source .env | |
out/gn_unittests | |
- name: Archive binaries | |
run: | | |
tar -C out -czf "out/gn-${{ matrix.slug }}.tar.gz" gn | |
- name: Upload archives | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: | | |
out/gn-${{ matrix.slug }}.tar.gz | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
out/gn-${{ matrix.slug }}.tar.gz | |
windows: | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- slug: windows-i386 | |
arch: x86 | |
gen_args: "--use-lto --use-icf" | |
ninja_release_name: v1.11.1/ninja-linux.zip | |
- slug: windows-amd64 | |
arch: x64 | |
gen_args: "--use-lto --use-icf" | |
ninja_release_name: v1.11.1/ninja-linux.zip | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: pwsh | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# we need all everything for `git describe` to work correctly | |
fetch-depth: 0 | |
- name: Download Ninja | |
run: | | |
Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -OutFile ninja.zip | |
7z x ninja.zip > nul | |
./ninja --version | |
- name: Set up Visual Studio shell | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Build | |
run: | | |
python build/gen.py ${{ matrix.gen_args }} | |
./ninja -C out | |
- name: Run tests | |
run: | | |
out/gn_unittests | |
- name: Make zip | |
run: | | |
7z a -tzip out\gn-${{ matrix.slug }}.zip out\gn.exe | |
- name: Upload archives | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: | | |
out/gn-${{ matrix.slug }}.zip | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
out/gn-${{ matrix.slug }}.zip |