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