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