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 component add clippy
 32          rustup target add wasm32-wasi
 33
 34      - name: Install Node
 35        uses: actions/setup-node@v2
 36        with:
 37          node-version: '16'
 38
 39      - name: Checkout repo
 40        uses: actions/checkout@v2
 41        with:
 42          clean: false
 43          
 44      - name: Run clippy
 45        run: cargo clippy --workspace -- -D warnings -A clippy::reversed_empty_ranges -A clippy::missing_safety_doc -A clippy::let_unit_value
 46        
 47      - name: Run tests
 48        run: cargo test --workspace --no-fail-fast
 49    
 50      - name: Build collab binaries
 51        run: cargo build --bins --all-features 
 52
 53  bundle:
 54    name: Bundle app
 55    runs-on:
 56      - self-hosted
 57      - bundle
 58    env:
 59      MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
 60      MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
 61      APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
 62      APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
 63    steps:
 64      - name: Install Rust
 65        run: |
 66          rustup set profile minimal
 67          rustup update stable
 68          rustup target add aarch64-apple-darwin
 69          rustup target add x86_64-apple-darwin
 70          rustup target add wasm32-wasi
 71
 72      - name: Install Node
 73        uses: actions/setup-node@v2
 74        with:
 75          node-version: '16'
 76
 77      - name: Checkout repo
 78        uses: actions/checkout@v2
 79        with:
 80          clean: false
 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 }}