|
| 1 | +--- |
| 2 | +name: ci |
| 3 | + |
| 4 | +"on": |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - main |
| 9 | + - develop |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - master |
| 13 | + - main |
| 14 | + - develop |
| 15 | +env: |
| 16 | + debug_ci: false |
| 17 | +jobs: |
| 18 | + test: |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + os: [macos-11] |
| 23 | + steps: |
| 24 | + - name: Check out code |
| 25 | + uses: actions/checkout@v2 |
| 26 | + - name: Set BREWFILE_PATH env var |
| 27 | + run: | |
| 28 | + echo "BREWFILE_PATH=${GITHUB_WORKSPACE}/Brewfile.ci" >> $GITHUB_ENV |
| 29 | + - uses: webfactory/ssh-agent@v0.5.4 |
| 30 | + with: |
| 31 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 32 | + - name: Add SSH_AUTH_SOCK to user shell .profile |
| 33 | + run: | |
| 34 | + sudo tee -a ~/.profile <<EOPROFILE |
| 35 | + SSH_AUTH_SOCK=${{ env.SSH_AUTH_SOCK }} |
| 36 | + EOPROFILE |
| 37 | + - name: Configure global git SSH URLs |
| 38 | + run: | |
| 39 | + git config --global url."git@github.com:".insteadOf "https://github.com/" |
| 40 | + - name: Configure Homebrew cache |
| 41 | + uses: actions/cache@v2 |
| 42 | + with: |
| 43 | + path: | |
| 44 | + ~/Library/Caches/Homebrew/*--* |
| 45 | + ~/Library/Caches/Homebrew/downloads/*--* |
| 46 | + ~/Library/Caches/Homebrew/Cask/*--* |
| 47 | + key: brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }} |
| 48 | + restore-keys: | |
| 49 | + brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }} |
| 50 | + brew-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }} |
| 51 | + - name: Run brew update |
| 52 | + run: | |
| 53 | + brew update |
| 54 | + - name: Install dependencies & Clean homebrew cache |
| 55 | + run: | |
| 56 | + brew cleanup |
| 57 | + brew bundle install --file=${BREWFILE_PATH} |
| 58 | + - name: DEBUG - GitHub Workspace |
| 59 | + run: | |
| 60 | + echo GITHUB_WORKSPACE=$GITHUB_WORKSPACE |
| 61 | + if: env.debug_ci == true |
| 62 | + - name: DEBUG - Print all shell env exports |
| 63 | + run: export -p |
| 64 | + if: env.debug_ci == true |
| 65 | + - name: DEBUG - List workspace and Homebrew contents |
| 66 | + run: | |
| 67 | + ls -lR ${GITHUB_WORKSPACE} |
| 68 | + ls -lR /usr/local/Homebrew |
| 69 | + if: env.debug_ci == true |
| 70 | + - name: Run tap install |
| 71 | + run: make install |
| 72 | + - name: Run test & install |
| 73 | + run: | |
| 74 | + make test |
| 75 | + - name: Upload install.log on failure |
| 76 | + if: ${{ failure() }} |
| 77 | + uses: actions/upload-artifact@v3 |
| 78 | + with: |
| 79 | + name: Build failure logs |
| 80 | + path: /var/log/install.log |
0 commit comments