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