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