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      ZED_MIXPANEL_TOKEN: ${{ secrets.ZED_MIXPANEL_TOKEN }}
 62    steps:
 63      - name: Install Rust
 64        run: |
 65          rustup set profile minimal
 66          rustup update stable
 67          rustup target add aarch64-apple-darwin
 68          rustup target add x86_64-apple-darwin
 69          rustup target add wasm32-wasi
 70
 71      - name: Install Node
 72        uses: actions/setup-node@v2
 73        with:
 74          node-version: '16'
 75
 76      - name: Checkout repo
 77        uses: actions/checkout@v2
 78        with:
 79          clean: false
 80          submodules: 'recursive'
 81
 82      - name: Validate version
 83        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 84        run: script/validate-version
 85
 86      - name: Create app bundle
 87        run: script/bundle
 88
 89      - name: Upload app bundle to workflow run if main branch
 90        uses: actions/upload-artifact@v2
 91        if: ${{ github.ref == 'refs/heads/main' }}
 92        with:
 93          name: Zed.dmg
 94          path: target/release/Zed.dmg
 95
 96      - uses: softprops/action-gh-release@v1
 97        name: Upload app bundle to release if release tag
 98        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 99        with:
100          draft: true
101          files: target/release/Zed.dmg
102          overwrite: true
103          body: ""
104        env:
105          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}