182 lines
5.9 KiB
YAML
182 lines
5.9 KiB
YAML
name: Linux
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: ['**']
|
|
tags-ignore: ['**'] # Don't trigger on tag pushes
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
fedora:
|
|
runs-on: [ubuntu-latest]
|
|
container:
|
|
image: fedora:40
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install dependencies
|
|
run: dnf install -y ninja-build cmake gtest-devel re2c clang util-linux clang-tools-extra
|
|
- name: Linting
|
|
run: misc/ci.py
|
|
- name: Configure with CMake
|
|
run: cmake -Bbuild -G"Ninja Multi-Config" -DNINJA_CLANG_TIDY=1
|
|
- name: Build debug ninja
|
|
run: CLICOLOR_FORCE=1 ninja
|
|
working-directory: build
|
|
- name: Test debug ninja
|
|
working-directory: build/Debug
|
|
run: |
|
|
./ninja_test --gtest_color=yes
|
|
../../misc/output_test.py
|
|
../../misc/jobserver_test.py
|
|
- name: Build release ninja
|
|
run: CLICOLOR_FORCE=1 ninja -f build-Release.ninja
|
|
working-directory: build
|
|
- name: Test release ninja
|
|
working-directory: build/Release
|
|
run: |
|
|
./ninja_test --gtest_color=yes
|
|
../../misc/output_test.py
|
|
../../misc/jobserver_test.py
|
|
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
host-os: ["ubuntu-latest", "ubuntu-24.04-arm"]
|
|
include:
|
|
- host-os: "ubuntu-24.04-arm"
|
|
arch: "-aarch64"
|
|
fail-fast: false
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
runs-on: ${{ matrix.host-os }}
|
|
container: rockylinux/rockylinux:8
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: codespell-project/actions-codespell@master
|
|
with:
|
|
ignore_words_list: fo,wee,addin,notin
|
|
- name: Install dependencies
|
|
run: |
|
|
dnf install -y make gcc-c++ libasan clang-analyzer cmake dnf-plugins-core epel-release
|
|
dnf config-manager --set-enabled powertools
|
|
dnf install -y gtest-devel p7zip p7zip-plugins ninja-build
|
|
|
|
- name: Build debug ninja
|
|
env:
|
|
CFLAGS: -fstack-protector-all -fsanitize=address
|
|
CXXFLAGS: -fstack-protector-all -fsanitize=address
|
|
run: |
|
|
scan-build -o scanlogs cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -B debug-build
|
|
scan-build -o scanlogs cmake --build debug-build --parallel --config Debug
|
|
|
|
- name: Test debug ninja
|
|
run: ASAN_OPTIONS=detect_leaks=0 ./ninja_test
|
|
working-directory: debug-build
|
|
|
|
- name: Build release ninja
|
|
run: |
|
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -B release-build -DCMAKE_COMPILE_WARNING_AS_ERROR=1
|
|
cmake --build release-build --parallel --config Release
|
|
strip release-build/ninja
|
|
|
|
- name: Test release ninja
|
|
run: ./ninja_test
|
|
working-directory: release-build
|
|
|
|
- name: Create ninja archive
|
|
run: |
|
|
mkdir artifact
|
|
7z a artifact/ninja-linux${{ matrix.arch }}.zip ./release-build/ninja
|
|
|
|
# Upload ninja binary archive as an artifact
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ninja${{ matrix.arch }}-binary-archives
|
|
path: artifact
|
|
|
|
- name: Upload release asset
|
|
if: github.event.action == 'published'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./artifact/ninja-linux${{ matrix.arch }}.zip
|
|
asset_name: ninja-linux${{ matrix.arch }}.zip
|
|
asset_content_type: application/zip
|
|
|
|
test:
|
|
runs-on: [ubuntu-latest]
|
|
container:
|
|
image: ubuntu:20.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install dependencies
|
|
run: |
|
|
apt update
|
|
apt install -y python3-pytest ninja-build python3-pip clang libgtest-dev
|
|
pip3 install cmake==3.17.*
|
|
- name: Configure (GCC)
|
|
run: cmake -Bbuild-gcc -DCMAKE_BUILD_TYPE=Debug -G'Ninja Multi-Config'
|
|
|
|
- name: Build (GCC, Debug)
|
|
run: cmake --build build-gcc --config Debug
|
|
- name: Unit tests (GCC, Debug)
|
|
run: ./build-gcc/Debug/ninja_test
|
|
- name: Python tests (GCC, Debug)
|
|
run: pytest-3 --color=yes ../..
|
|
working-directory: build-gcc/Debug
|
|
|
|
- name: Build (GCC, Release)
|
|
run: cmake --build build-gcc --config Release
|
|
- name: Unit tests (GCC, Release)
|
|
run: ./build-gcc/Release/ninja_test
|
|
- name: Python tests (GCC, Release)
|
|
run: pytest-3 --color=yes ../..
|
|
working-directory: build-gcc/Release
|
|
|
|
- name: Configure (Clang)
|
|
run: CC=clang CXX=clang++ cmake -Bbuild-clang -DCMAKE_BUILD_TYPE=Debug -G'Ninja Multi-Config'
|
|
|
|
- name: Build (Clang, Debug)
|
|
run: cmake --build build-clang --config Debug
|
|
- name: Unit tests (Clang, Debug)
|
|
run: ./build-clang/Debug/ninja_test
|
|
- name: Python tests (Clang, Debug)
|
|
run: pytest-3 --color=yes ../..
|
|
working-directory: build-clang/Debug
|
|
|
|
- name: Build (Clang, Release)
|
|
run: cmake --build build-clang --config Release
|
|
- name: Unit tests (Clang, Release)
|
|
run: ./build-clang/Release/ninja_test
|
|
- name: Python tests (Clang, Release)
|
|
run: pytest-3 --color=yes ../..
|
|
working-directory: build-clang/Release
|
|
|
|
build-with-python:
|
|
runs-on: [ubuntu-latest]
|
|
container:
|
|
image: ${{ matrix.image }}
|
|
strategy:
|
|
matrix:
|
|
image: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install dependencies
|
|
run: |
|
|
apt update
|
|
apt install -y g++ python3
|
|
- name: ${{ matrix.image }}
|
|
run: |
|
|
# Do not set --warnings-as-errors here as that triggers an irrelevant
|
|
# compiler warnings in <stdio.h> with ubuntu:24.04. See issue #2615
|
|
python3 configure.py --bootstrap
|
|
./ninja all
|
|
python3 misc/ninja_syntax_test.py
|
|
./misc/output_test.py
|