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