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: >
 46            cargo clippy --workspace -- 
 47            -Dwarnings 
 48            -Aclippy::reversed_empty_ranges 
 49            -Aclippy::missing_safety_doc 
 50            -Aclippy::let_unit_value
 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
 70        run: |
 71          rustup set profile minimal
 72          rustup update stable
 73          rustup target add aarch64-apple-darwin
 74          rustup target add x86_64-apple-darwin
 75          rustup target add wasm32-wasi
 76
 77      - name: Install Node
 78        uses: actions/setup-node@v2
 79        with:
 80          node-version: '16'
 81
 82      - name: Checkout repo
 83        uses: actions/checkout@v2
 84        with:
 85          clean: false
 86
 87      - name: Validate version
 88        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
 89        run: script/validate-version
 90
 91      - name: Create app bundle
 92        run: script/bundle
 93
 94      - name: Upload app bundle to workflow run if main branch
 95        uses: actions/upload-artifact@v2
 96        if: ${{ github.ref == 'refs/heads/main' }}
 97        with:
 98          name: Zed.dmg
 99          path: target/release/Zed.dmg
100
101      - uses: softprops/action-gh-release@v1
102        name: Upload app bundle to release if release tag
103        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
104        with:
105          draft: true
106          files: target/release/Zed.dmg
107          overwrite: true
108          body: ""
109        env:
110          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}