|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + Test: |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Create Cache Timestamp |
| 21 | + id: cache_timestamp |
| 22 | + |
| 23 | + with: |
| 24 | + format: 'YYYY-MM-DD-HH-mm-ss' |
| 25 | + |
| 26 | + - name: Mount bazel cache |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: "~/.cache/bazel" |
| 30 | + key: bazelcache_test_${{ steps.cache_timestamp.outputs.time }} |
| 31 | + restore-keys: bazelcache_test_ |
| 32 | + |
| 33 | + - name: Test |
| 34 | + run: | |
| 35 | + export CC=gcc-13 |
| 36 | + export CXX=g++-13 |
| 37 | + bazel test --noshow_progress --keep_going ... |
| 38 | +
|
| 39 | + MacOsBuild: |
| 40 | + runs-on: macos-latest |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + |
| 47 | + - name: Test |
| 48 | + run: | |
| 49 | + bazel test --noshow_progress --keep_going ... |
| 50 | +
|
| 51 | + - name: Build |
| 52 | + run: | |
| 53 | + bazel build --noshow_progress -c opt //fpga:fpga-as |
| 54 | +
|
| 55 | + CodeFormatting: |
| 56 | + runs-on: ubuntu-24.04 |
| 57 | + steps: |
| 58 | + - name: Checkout code |
| 59 | + uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + fetch-depth: 0 |
| 62 | + |
| 63 | + - name: Install Dependencies |
| 64 | + run: | |
| 65 | + sudo apt-get install clang-format-18 |
| 66 | +
|
| 67 | + - name: Run formatting style check |
| 68 | + run: | |
| 69 | + clang-format-18 --version |
| 70 | + CLANG_FORMAT=clang-format-18 scripts/run-clang-format.sh |
| 71 | + git diff > /tmp/format-diff |
| 72 | + if [ -s "/tmp/format-diff" ]; then |
| 73 | + echo "Difference to optimal formatting" |
| 74 | + cat /tmp/format-diff |
| 75 | + echo |
| 76 | + echo "=================== To Fix ===========================" |
| 77 | + echo "Run scripts/run-format.sh" |
| 78 | + echo "then" |
| 79 | + echo " git commit -a --amend" |
| 80 | + echo " git push -f" |
| 81 | + exit 1 |
| 82 | + fi |
| 83 | +
|
| 84 | + ClangTidy: |
| 85 | + runs-on: ubuntu-24.04 |
| 86 | + steps: |
| 87 | + - name: Checkout code |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + fetch-depth: 0 |
| 91 | + |
| 92 | + - name: Install Dependencies |
| 93 | + run: | |
| 94 | + sudo apt-get install clang-tidy-18 |
| 95 | +
|
| 96 | + - name: Create Cache Timestamp |
| 97 | + id: cache_timestamp |
| 98 | + |
| 99 | + with: |
| 100 | + format: 'YYYY-MM-DD-HH-mm-ss' |
| 101 | + |
| 102 | + - name: Mount clang-tidy cache |
| 103 | + uses: actions/cache@v4 |
| 104 | + with: |
| 105 | + path: | |
| 106 | + ~/.cache/clang-tidy |
| 107 | + ~/.cache/bazel |
| 108 | + key: clang-tidy-cache_${{ steps.cache_timestamp.outputs.time }} |
| 109 | + restore-keys: clang-tidy-cache_ |
| 110 | + |
| 111 | + - name: Build Compilation DB |
| 112 | + run: | |
| 113 | + scripts/make-compilation-db.sh |
| 114 | +
|
| 115 | + - name: Run clang-tidy |
| 116 | + run: | |
| 117 | + clang-tidy-18 --version |
| 118 | + CLANG_TIDY=clang-tidy-18 scripts/run-clang-tidy-cached.cc \ |
| 119 | + || ( cat fpga-assembler_clang-tidy.out ; exit 1) |
| 120 | +
|
0 commit comments