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: Validate version
74 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
75 run: script/validate-version
76
77 - name: Download rust-analyzer
78 run: script/download-rust-analyzer
79
80 - name: Create app bundle
81 run: script/bundle
82
83 - name: Upload app bundle to workflow run if main branch
84 uses: actions/upload-artifact@v2
85 if: ${{ github.ref == 'refs/heads/main' }}
86 with:
87 name: Zed.dmg
88 path: target/release/Zed.dmg
89
90 - uses: softprops/action-gh-release@v1
91 name: Upload app bundle to release if release tag
92 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
93 with:
94 draft: true
95 files: target/release/Zed.dmg
96 overwrite: true
97 body: ""
98 env:
99 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}