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