|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Install packages |
| 18 | + run: sudo apt-get install ninja-build ripgrep |
| 19 | + |
| 20 | + - name: Download artifact |
| 21 | + uses: dawidd6/action-download-artifact@v2 |
| 22 | + with: |
| 23 | + workflow: main.yml |
| 24 | + name: libgccjit.so |
| 25 | + path: gcc-build |
| 26 | + repo: antoyo/gcc |
| 27 | + |
| 28 | + - name: Setup path to libgccjit |
| 29 | + run: | |
| 30 | + echo $(readlink -f gcc-build) > gcc_path |
| 31 | + ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0 |
| 32 | +
|
| 33 | + - name: Set LIBRARY_PATH |
| 34 | + run: echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV |
| 35 | + |
| 36 | + # https://github.com/actions/cache/issues/133 |
| 37 | + - name: Fixup owner of ~/.cargo/ |
| 38 | + # Don't remove the trailing /. It is necessary to follow the symlink. |
| 39 | + run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ |
| 40 | + |
| 41 | + - name: Cache cargo installed crates |
| 42 | + uses: actions/cache@v1.1.2 |
| 43 | + with: |
| 44 | + path: ~/.cargo/bin |
| 45 | + key: cargo-installed-crates2-ubuntu-latest |
| 46 | + |
| 47 | + - name: Cache cargo registry |
| 48 | + uses: actions/cache@v1 |
| 49 | + with: |
| 50 | + path: ~/.cargo/registry |
| 51 | + key: ${{ runner.os }}-cargo-registry2-${{ hashFiles('**/Cargo.lock') }} |
| 52 | + |
| 53 | + - name: Cache cargo index |
| 54 | + uses: actions/cache@v1 |
| 55 | + with: |
| 56 | + path: ~/.cargo/git |
| 57 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 58 | + |
| 59 | + - name: Cache cargo target dir |
| 60 | + uses: actions/cache@v1.1.2 |
| 61 | + with: |
| 62 | + path: target |
| 63 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }} |
| 64 | + |
| 65 | + - name: Build |
| 66 | + run: | |
| 67 | + ./prepare_build.sh |
| 68 | + ./build.sh |
| 69 | + ./clean_all.sh |
| 70 | +
|
| 71 | + - name: Prepare dependencies |
| 72 | + run: | |
| 73 | + git config --global user.email "user@example.com" |
| 74 | + git config --global user.name "User" |
| 75 | + ./prepare.sh |
| 76 | +
|
| 77 | + # Compile is a separate step, as the actions-rs/cargo action supports error annotations |
| 78 | + - name: Compile |
| 79 | + uses: actions-rs/cargo@v1.0.3 |
| 80 | + with: |
| 81 | + command: build |
| 82 | + args: --release |
| 83 | + |
| 84 | + - name: Test |
| 85 | + run: | |
| 86 | + # Enable backtraces for easier debugging |
| 87 | + export RUST_BACKTRACE=1 |
| 88 | +
|
| 89 | + # Reduce amount of benchmark runs as they are slow |
| 90 | + export COMPILE_RUNS=2 |
| 91 | + export RUN_RUNS=2 |
| 92 | +
|
| 93 | + ./test.sh --release |
0 commit comments