1name: CI
2
3on:
4  push:
5  pull_request:
6  schedule: [cron: "40 1 * * *"]
7
8jobs:
9  test:
10    name: ${{matrix.name || format('Rust {0}', matrix.rust)}}
11    runs-on: ${{matrix.os || 'ubuntu'}}-latest
12    strategy:
13      fail-fast: false
14      matrix:
15        include:
16          - rust: nightly
17          - rust: beta
18          - rust: stable
19          - rust: 1.48.0
20          - name: macOS
21            rust: nightly
22            os: macos
23          - name: Windows (gnu)
24            rust: nightly-x86_64-pc-windows-gnu
25            os: windows
26          - name: Windows (msvc)
27            rust: nightly-x86_64-pc-windows-msvc
28            os: windows
29            flags: /EHsc
30    env:
31      CXXFLAGS: ${{matrix.flags}}
32      RUSTFLAGS: --cfg deny_warnings
33    steps:
34      - name: Enable symlinks (windows)
35        if: matrix.os == 'windows'
36        run: git config --global core.symlinks true
37      - uses: actions/checkout@v2
38      - uses: dtolnay/rust-toolchain@master
39        with:
40          toolchain: ${{matrix.rust}}
41      - name: Determine test suite subset
42        # Our Windows and macOS jobs are the longest running, so exclude the
43        # relatively slow compiletest from them to speed up end-to-end CI time,
44        # except during cron builds when no human is presumably waiting on the
45        # build. The extra coverage is not particularly valuable and we can
46        # still ensure the test is kept passing on the basis of the scheduled
47        # builds.
48        if: matrix.os && github.event_name != 'schedule'
49        run: echo "RUSTFLAGS=--cfg skip_ui_tests $RUSTFLAGS" >> $GITHUB_ENV
50        shell: bash
51      - run: cargo run --manifest-path demo/Cargo.toml
52      - run: cargo test --workspace --exclude cxx-test-suite
53
54  buck:
55    name: Buck
56    runs-on: ubuntu-latest
57    steps:
58      - uses: actions/checkout@v2
59      - uses: dtolnay/rust-toolchain@stable
60      - uses: actions/setup-java@v1
61        with:
62          java-version: 11
63          java-package: jre
64      - name: Install Buck
65        run: |
66          mkdir bin
67          wget -q -O bin/buck https://jitpack.io/com/github/facebook/buck/a5f0342ae3/buck-a5f0342ae3-java11.pex # dev branch from 2020.10.11
68          chmod +x bin/buck
69          echo bin >> $GITHUB_PATH
70      - name: Install lld
71        run: sudo apt-get install lld
72      - name: Vendor dependencies
73        run: |
74          cp third-party/Cargo.lock .
75          cargo vendor --versioned-dirs --locked third-party/vendor
76      - run: buck build :cxx#check --verbose=0
77      - run: buck run demo --verbose=0
78      - run: buck test ... --verbose=0
79
80  bazel:
81    name: Bazel
82    runs-on: ubuntu-latest
83    steps:
84      - uses: actions/checkout@v2
85      - name: Install Bazel
86        run: |
87          wget -q -O install.sh https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-installer-linux-x86_64.sh
88          chmod +x install.sh
89          ./install.sh --user
90          echo $HOME/bin >> $GITHUB_PATH
91      - run: bazel run demo --verbose_failures --noshow_progress
92      - run: bazel test ... --verbose_failures --noshow_progress
93
94  clippy:
95    name: Clippy
96    runs-on: ubuntu-latest
97    if: github.event_name != 'pull_request'
98    steps:
99      - uses: actions/checkout@v2
100      - uses: dtolnay/rust-toolchain@clippy
101      - run: cargo clippy --workspace --tests -- -Dclippy::all
102
103  clang-tidy:
104    name: Clang Tidy
105    runs-on: ubuntu-latest
106    if: github.event_name != 'pull_request'
107    steps:
108      - uses: actions/checkout@v2
109      - name: Install clang-tidy
110        run: sudo apt-get install clang-tidy-11
111      - name: Run clang-tidy
112        run: clang-tidy-11 src/cxx.cc --warnings-as-errors=*
113