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