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