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