|
| 1 | +name: Test Mac |
| 2 | + |
| 3 | +# Run on our main branch and any PRs to it, and on release tags, but not every |
| 4 | +# commit in every branch. |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + tags: |
| 10 | + - "*" |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - master |
| 14 | + |
| 15 | +jobs: |
| 16 | + testmac: |
| 17 | + name: Test on Mac |
| 18 | + runs-on: macos-12 |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Use cache |
| 22 | + uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: | |
| 25 | + deps |
| 26 | + lib |
| 27 | + include |
| 28 | + bin |
| 29 | + key: ${{ runner.os }}-12-${{ github.ref }} |
| 30 | + # Restore keys are a "list", but really only a multiline string is |
| 31 | + # accepted. Also we match by prefix. And the most recent cache is |
| 32 | + # used, not the most specific. |
| 33 | + # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-12-${{ github.base_ref }} |
| 36 | + ${{ runner.os }}-12 |
| 37 | + |
| 38 | + - name: Checkout code without submodules |
| 39 | + uses: actions/checkout@v2 |
| 40 | + |
| 41 | + - name: Get or restore dependencies |
| 42 | + run: scripts/restore-deps.sh |
| 43 | + |
| 44 | + - name: Install packages |
| 45 | + # We don't use artemnovichkov/action-homebrew because that's for Linux. |
| 46 | + # We uninstall everything we don't need in order to prevent linking |
| 47 | + # conflicts with existing/outdated packages, which we can't resolve |
| 48 | + # because there's no way to tell Homebrew to force-link when installing |
| 49 | + # from a Brewfile. We also update Protobuf to make sure we have 3.21.3+ |
| 50 | + # to avoid problems with ABI changes with/without -DNDEBUG. |
| 51 | + # And we update libomp to make extra sure it will be picked up by the compiler. |
| 52 | + # We pre-install a pinned txm to work around https://github.com/anko/txm/issues/8 |
| 53 | + run: | |
| 54 | + brew bundle cleanup --force && \ |
| 55 | + brew bundle install && \ |
| 56 | + brew update && \ |
| 57 | + brew install protobuf && \ |
| 58 | + brew install libomp && \ |
| 59 | + npm install -g txm@7.4.5 && \ |
| 60 | + brew config && \ |
| 61 | + (brew doctor || echo "brew doctor is unhappy") |
| 62 | +
|
| 63 | + - name: Run build and test |
| 64 | + run: | |
| 65 | + export VG_FULL_TRACEBACK=1 |
| 66 | + echo "Build with $(nproc) threads" |
| 67 | + set +e |
| 68 | + make -j$(nproc) test |
| 69 | + RETVAL=$? |
| 70 | + set -e |
| 71 | + # Whether vg testing succeeds or fails, see if we can get any Apple crash logs for it. |
| 72 | + ls ~/Library/Logs/DiagnosticReports/ |
| 73 | + for CRASH_FILE in $(ls ~/Library/Logs/DiagnosticReports/vg-* 2>/dev/null) ; do |
| 74 | + echo "vg crash report found: ${CRASH_FILE}" |
| 75 | + cat ${CRASH_FILE} |
| 76 | + done |
| 77 | + exit $RETVAL |
| 78 | + shell: bash |
0 commit comments