diff options
-rw-r--r-- | docs/markdown/Continuous-Integration.md | 150 |
1 files changed, 100 insertions, 50 deletions
diff --git a/docs/markdown/Continuous-Integration.md b/docs/markdown/Continuous-Integration.md index 13a9a00..0846f2d 100644 --- a/docs/markdown/Continuous-Integration.md +++ b/docs/markdown/Continuous-Integration.md @@ -6,20 +6,16 @@ Travis and AppVeyor. Please [file an issue](https://github.com/mesonbuild/meson/issues/new) if these instructions don't work for you. -## Travis for OS X and Linux (with Docker) +## Travis-CI with Docker -Travis for Linux provides ancient versions of Ubuntu which will likely -cause problems building your projects regardless of which build system -you're using. We recommend using Docker to get a more-recent version -of Ubuntu and installing Ninja, Python3, and Meson inside it. +Travis with Docker gives access to newer non-LTS Ubuntu versions with +pre-installed libraries of your choice. -This `yml` file is derived from the [configuration used by Meson for -running its own -tests](https://github.com/mesonbuild/meson/blob/master/.travis.yml). +This `yml` file is derived from the +[configuration used by Meson](https://github.com/mesonbuild/meson/blob/master/.travis.yml) +for running its own tests. ```yaml -sudo: false - os: - linux - osx @@ -34,10 +30,10 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3 ninja; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip3 install meson; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull YOUR/REPO:yakkety; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull YOUR/REPO:eoan; fi script: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM YOUR/REPO:yakkety > Dockerfile; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM YOUR/REPO:eoan > Dockerfile; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true CC=$CC CXX=$CXX meson builddir && ninja -C builddir test"; fi @@ -46,7 +42,7 @@ script: ## CircleCi for Linux (with Docker) -[CircleCi](https://circleci.com/) can work for spinning all of the Linux images you wish. +[CircleCi](https://circleci.com/) can work for spinning all of the Linux images you wish. Here's a sample `yml` file for use with that. ```yaml @@ -59,7 +55,7 @@ executors: docker: - image: your_dockerhub_username/ubuntu-sys - meson_debain_builder: + meson_debian_builder: docker: - image: your_dockerhub_username/debian-sys @@ -76,8 +72,8 @@ jobs: - run: ninja -C builddir - run: meson test -C builddir - meson_debain_build: - executor: meson_debain_builder + meson_debian_build: + executor: meson_debian_builder steps: - checkout - run: meson setup builddir --backend ninja @@ -97,17 +93,20 @@ workflows: linux_workflow: jobs: - meson_ubuntu_build - - meson_debain_build + - meson_debian_build - meson_fedora_build ``` ## AppVeyor for Windows -For CI on Windows, [AppVeyor](https://www.appveyor.com/) is probably -your best bet. Here's a sample `yml` file for use with that. +For CI on Windows, [AppVeyor](https://www.appveyor.com/) has a wide selection of +[default configurations](https://www.appveyor.com/docs/windows-images-software/). +AppVeyor also has [MacOS](https://www.appveyor.com/docs/macos-images-software/) and +[Linux](https://www.appveyor.com/docs/linux-images-software/) CI images. +This is a sample `appveyor.yml` file for Windows with Visual Studio 2015 and 2017. ```yaml -os: Visual Studio 2017 +image: Visual Studio 2017 environment: matrix: @@ -148,9 +147,11 @@ test_script: ### Qt For Qt 5, add the following line near the `PYTHON_ROOT` assignment: + ```yaml - cmd: if %arch%==x86 (set QT_ROOT=C:\Qt\5.11\%compiler%) else (set QT_ROOT=C:\Qt\5.11\%compiler%_64) ``` + And afterwards add `%QT_ROOT%\bin` to the `PATH` variable. You might have to adjust your build matrix as there are, for example, no msvc2017 32-bit builds. Visit the [Build Environment](https://www.appveyor.com/docs/build-environment/) page in the AppVeyor docs for more details. @@ -158,35 +159,31 @@ You might have to adjust your build matrix as there are, for example, no msvc201 ### Boost The following statement is sufficient for meson to find Boost: + ```yaml - cmd: set BOOST_ROOT=C:\Libraries\boost_1_67_0 ``` ## Travis without Docker -You can cheat your way around docker by using **python** as language and setting your compiler in the build **matrix**. This example just uses **linux** and **c** but can be easily adapted to **c++** and **osx**. +Non-Docker Travis-CI builds can use Linux, MacOS or Windows. +Set the desired compiler(s) in the build **matrix**. +This example is for **Linux** (Ubuntu 18.04) and **C**. ```yaml -sudo: false +dist: bionic +group: travis_latest os: linux -dist: trusty - language: python -python: 3.6 - matrix: include: - env: CC=gcc - env: CC=clang install: - - export NINJA_LATEST=$(curl -s https://api.github.com/repos/ninja-build/ninja/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep ninja-linux.zip) - - wget "$NINJA_LATEST" - - unzip -q ninja-linux.zip -d build - - export PATH="$PWD/build:$PATH" - - pip install meson + - pip install meson ninja script: - meson builddir @@ -194,27 +191,80 @@ script: - ninja -C builddir test ``` -This setup uses the **beta** group. It is not recommended but included here for completeness: +## GitHub Actions -```yaml -sudo: false -language: cpp -group: beta +GitHub Actions are distinct from Azure Pipelines in their workflow syntax. +It can be easier to setup specific CI tasks in Actions than Pipelines, depending on the particular task. +This is an example file: .github/workflows/ci_meson.yml supposing the project is C-based, using GCC on Linux, Mac and Windows. +The optional `on:` parameters only run this CI when the C code is changed--corresponding ci_python.yml might run only on "**.py" file changes. -matrix: - include: - - os: linux - dist: trusty - - os: osx +```yml +name: ci_meson -install: - - export PATH="$(pwd)/build:${PATH}" - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install python3 ninja; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip && unzip -q ninja-linux.zip -d build; fi - - pip3 install meson +on: + push: + paths: + - "**.c" + - "**.h" + pull_request: + paths: + - "**.h" + - "**.h" -script: - - meson builddir - - ninja -C builddir - - ninja -C builddir test +jobs: + + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - run: pip install meson ninja + - run: meson setup build + env: + CC: gcc + - run: meson test -C build -v + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: Linux_Meson_Testlog + path: build/meson-logs/testlog.txt + + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - run: brew install gcc + - run: pip install meson ninja + - run: meson setup build + env: + CC: gcc + - run: meson test -C build -v + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: MacOS_Meson_Testlog + path: build/meson-logs/testlog.txt + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - run: pip install meson ninja + - run: meson setup build + env: + CC: gcc + - run: meson test -C build -v + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: Windows_Meson_Testlog + path: build/meson-logs/testlog.txt ``` |