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: self-hosted
22    steps:
23      - name: Install Rust
24        uses: actions-rs/toolchain@v1
25        with:
26          toolchain: stable
27          target: x86_64-apple-darwin
28          profile: minimal
29
30      - name: Checkout repo
31        uses: actions/checkout@v2
32        with:
33          clean: false
34
35      - name: Run tests
36        run: cargo test --no-fail-fast
37
38  bundle:
39    name: Bundle app
40    runs-on: self-hosted
41    steps:
42      - name: Install Rust x86_64-apple-darwin target
43        uses: actions-rs/toolchain@v1
44        with:
45          toolchain: stable
46          target: x86_64-apple-darwin
47          profile: minimal
48
49      - name: Install Rust aarch64-apple-darwin target
50        uses: actions-rs/toolchain@v1
51        with:
52          toolchain: stable
53          target: aarch64-apple-darwin
54          profile: minimal
55
56      - name: Checkout repo
57        uses: actions/checkout@v2
58        with:
59          clean: false
60
61      - name: Create app bundle
62        run: script/bundle
63
64      - name: Upload app bundle to workflow run if main branch
65        uses: actions/upload-artifact@v2
66        if: ${{ github.ref == 'refs/heads/main' }}
67        with:
68          name: Zed.dmg
69          path: target/release/Zed.dmg
70
71      - uses: softprops/action-gh-release@v1
72        name: Upload app bundle to release if release tag
73        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
74        with:
75          draft: true
76          files: target/release/Zed.dmg
77          overwrite: true
78          body: ""
79        env:
80          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}