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