ci.yml

  1name: CI
  2
  3on:
  4  push:
  5    branches:
  6      - main
  7    tags:
  8      - "v*"
  9  pull_request:
 10    branches:
 11      - "**"
 12
 13env:
 14  CARGO_TERM_COLOR: always
 15  CARGO_INCREMENTAL: 0
 16  RUST_BACKTRACE: 1
 17
 18jobs:
 19  tests:
 20    name: Run tests
 21    runs-on:
 22      - self-hosted
 23      - test
 24    env:
 25      RUSTFLAGS: -D warnings
 26    steps:
 27      - name: Install Rust
 28        run: |
 29          rustup set profile minimal
 30          rustup update stable
 31          rustup target add wasm32-wasi
 32
 33      - name: Install Node
 34        uses: actions/setup-node@v2
 35        with:
 36          node-version: '16'
 37
 38      - name: Checkout repo
 39        uses: actions/checkout@v2
 40        with:
 41          clean: false
 42          submodules: 'recursive'
 43            
 44      - name: Run tests
 45        run: cargo test --workspace --no-fail-fast
 46    
 47      - name: Build collab binaries
 48        run: cargo build --bins --all-features 
 49
 50  bundle:
 51    name: Bundle app
 52    runs-on:
 53      - self-hosted
 54      - bundle
 55    env:
 56      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 57      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 58      APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
 59      APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
 60      ZED_AMPLITUDE_API_KEY: ${{ secrets.ZED_AMPLITUDE_API_KEY }}
 61    steps:
 62      - name: Install Rust
 63        run: |
 64          rustup set profile minimal
 65          rustup update stable
 66          rustup target add aarch64-apple-darwin
 67          rustup target add x86_64-apple-darwin
 68          rustup target add wasm32-wasi
 69
 70      - name: Install Node
 71        uses: actions/setup-node@v2
 72        with:
 73          node-version: '16'
 74
 75      - name: Checkout repo
 76        uses: actions/checkout@v2
 77        with:
 78          clean: false
 79          submodules: 'recursive'
 80
 81      - name: Validate version
 82        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 83        run: script/validate-version
 84
 85      - name: Create app bundle
 86        run: script/bundle
 87
 88      - name: Upload app bundle to workflow run
 89        uses: actions/upload-artifact@v2
 90        with:
 91          name: Zed.dmg
 92          path: target/release/Zed.dmg
 93
 94      - uses: softprops/action-gh-release@v1
 95        name: Upload app bundle to release if release tag
 96        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 97        with:
 98          draft: true
 99          files: target/release/Zed.dmg
100          overwrite: true
101          body: ""
102        env:
103          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}