ci.yml

  1name: CI
  2
  3on:
  4  push:
  5    branches:
  6      - master
  7    tags:
  8      - "v*"
  9  pull_request:
 10    branches:
 11      - "**"
 12
 13env:
 14  CARGO_TERM_COLOR: always
 15  CARGO_INCREMENTAL: 0
 16
 17jobs:
 18  tests:
 19    name: Run tests
 20    runs-on: self-hosted
 21    steps:
 22      - name: Checkout repo
 23        uses: actions/checkout@v2
 24
 25      # Work around https://github.com/actions/cache/issues/403.
 26      - name: Use GNU tar
 27        run: |
 28          echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
 29
 30      - name: Cache artifacts
 31        id: cache
 32        uses: actions/cache@v2
 33        with:
 34          path: |
 35            ~/.cargo/registry
 36            ~/.cargo/git
 37            ~/.rustup
 38            target
 39          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
 40
 41      - name: Install Rust
 42        if: steps.cache.outputs.cache-hit != 'true'
 43        uses: actions-rs/toolchain@v1
 44        with:
 45          toolchain: stable
 46          target: x86_64-apple-darwin
 47          profile: minimal
 48
 49      - name: Run tests
 50        run: cargo test --no-fail-fast
 51
 52  bundle:
 53    name: Bundle app
 54    runs-on: self-hosted
 55    steps:
 56      - name: Checkout repo
 57        uses: actions/checkout@v2
 58
 59      # Work around https://github.com/actions/cache/issues/403.
 60      - name: Use GNU tar
 61        run: |
 62          echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
 63
 64      - name: Cache artifacts
 65        id: cache
 66        uses: actions/cache@v2
 67        with:
 68          path: |
 69            ~/.cargo/registry
 70            ~/.cargo/git
 71            ~/.rustup
 72            target
 73          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
 74
 75      - name: Install Rust
 76        if: steps.cache.outputs.cache-hit != 'true'
 77        uses: actions-rs/toolchain@v1
 78        with:
 79          toolchain: stable
 80          target: x86_64-apple-darwin
 81          profile: minimal
 82
 83      - name: Create app bundle
 84        run: script/bundle
 85
 86      - name: Upload app bundle to workflow run
 87        uses: actions/upload-artifact@v2
 88        with:
 89          name: Zed.dmg
 90          path: target/release/Zed.dmg
 91
 92      - uses: svenstaro/upload-release-action@v2
 93        name: Upload app bundle to release
 94        if: ${{ startsWith(github.github.ref, 'refs/tags/v') }}
 95        with:
 96          repo_token: ${{ secrets.GITHUB_TOKEN }}
 97          file: target/release/Zed.dmg
 98          asset_name: Zed.dmg
 99          tag: ${{ github.ref }}
100          overwrite: true
101          body: ""