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            
 43      - name: Run tests
 44        run: cargo test --workspace --no-fail-fast
 45    
 46      - name: Build collab binaries
 47        run: cargo build --bins --all-features 
 48
 49  bundle:
 50    name: Bundle app
 51    runs-on:
 52      - self-hosted
 53      - bundle
 54    env:
 55      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 56      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 57      APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
 58      APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
 59      ZED_MIXPANEL_TOKEN: ${{ secrets.ZED_MIXPANEL_TOKEN }}
 60    steps:
 61      - name: Install Rust
 62        run: |
 63          rustup set profile minimal
 64          rustup update stable
 65          rustup target add aarch64-apple-darwin
 66          rustup target add x86_64-apple-darwin
 67          rustup target add wasm32-wasi
 68
 69      - name: Install Node
 70        uses: actions/setup-node@v2
 71        with:
 72          node-version: '16'
 73
 74      - name: Checkout repo
 75        uses: actions/checkout@v2
 76        with:
 77          clean: false
 78
 79      - name: Validate version
 80        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 81        run: script/validate-version
 82
 83      - name: Create app bundle
 84        run: script/bundle
 85
 86      - name: Upload app bundle to workflow run if main branch
 87        uses: actions/upload-artifact@v2
 88        if: ${{ github.ref == 'refs/heads/main' }}
 89        with:
 90          name: Zed.dmg
 91          path: target/release/Zed.dmg
 92
 93      - uses: softprops/action-gh-release@v1
 94        name: Upload app bundle to release if release tag
 95        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 96        with:
 97          draft: true
 98          files: target/release/Zed.dmg
 99          overwrite: true
100          body: ""
101        env:
102          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}