Skip to content

CI

CI #77

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
unix-like:
strategy:
fail-fast: false
matrix:
runs-on: [ macos-12 ]
compiler: [ 'gcc' ] # Only used on linux
libclang: [ true ] # Only used on linux
benchmark: [ true, false ]
env:
USE_CLANG_COMPLETER: ${{ matrix.libclang }}
COVERAGE: ${{ !matrix.benchmark }}
name: "${{ matrix.runs-on }} - ${{ matrix.name_suffix }}${{ matrix.benchmark && 'C++ Benchmark' || 'test run' }}"
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v3
if: matrix.libclang == true && matrix.benchmark == false
with:
key: v3-libclang-${{ runner.os }}-${{ hashFiles( 'cpp/ycm/CMakeLists.txt' ) }}
restore-keys: |
v3-libclang-${{ runner.os }}-
v2-libclang-${{ runner.os }}-${{ hashFiles( 'cpp/ycm/CMakeLists.txt' ) }}
v2-libclang-${{ runner.os }}-
v1-libclang-${{ runner.os }}-
path: |
clang_archives
name: Cache libclang
- uses: actions/cache@v3
if: matrix.benchmark == false
with:
key: v2-deps-${{ runner.os }}-${{ hashFiles( 'build.py' ) }}
restore-keys: |
v2-deps-${{ runner.os }}-
v1-deps-${{ runner.os }}-
path: |
third-party/clangd/cache
third_party/eclipse.jdt.ls/target/cache
third_party/go
third_party/omnisharp-roslyn/v[0-9]*
name: Cache dependencies
- uses: actions/cache@v3
if: matrix.benchmark == false
with:
key: v2-testdeps-${{ runner.os }}-${{ hashFiles( 'run_tests.py' ) }}
restore-keys: |
v2-testdeps-${{ runner.os }}-
v1-testdeps-${{ runner.os }}-
path: |
third-party/lombok/cache
~/.npm
name: Cache test deps
- name: Install Java
if: matrix.benchmark == false
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt'
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Go
if: matrix.benchmark == false
uses: actions/setup-go@v4
with:
go-version: stable
cache: false
- name: Install GCC
if: runner.os == 'Linux' && matrix.compiler != 'clang'
run: |
sudo apt-get update
sudo apt-get install gcc-8 g++-8
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 100
- name: Install Clang
if: runner.os == 'Linux' && matrix.compiler == 'clang'
run: |
sudo apt-get update
sudo apt-get install clang-7
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-7 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-7 100
- name: Run pip and prepare coverage
if: matrix.benchmark == false
run: |
python3 -m pip install -r test_requirements.txt
echo -e "import coverage\ncoverage.process_startup()" > $(python -c "print(__import__('sysconfig').get_path('purelib'))")/sitecustomize.py
- name: Run tests
if: matrix.benchmark == false
run: python3 run_tests.py --quiet
- name: ssh
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
- name: Run benchmarks
if: matrix.benchmark == true
run: python3 benchmark.py --quiet
- name: Combine and summarise coverage
if: matrix.benchmark == false
run: coverage combine && coverage xml
- name: Upload coverage data
uses: codecov/codecov-action@v3
if: matrix.benchmark == false
with:
name: "${{ matrix.runs-on }}-${{ matrix.name_suffix }}-tests"
token: ${{ secrets.CODECOV_TOKEN }}
gcov: true