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 run: |
29 rustup set profile minimal
30 rustup update stable
31 rustup target add wasm32-wasi
32
33 - name: Install Node
34 uses: actions/setup-node@v2
35 with:
36 node-version: '16'
37
38 - name: Checkout repo
39 uses: actions/checkout@v2
40 with:
41 clean: false
42 submodules: 'recursive'
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 ZED_MIXPANEL_TOKEN: ${{ secrets.ZED_MIXPANEL_TOKEN }}
61 steps:
62 - name: Install Rust
63 run: |
64 rustup set profile minimal
65 rustup update stable
66 rustup target add aarch64-apple-darwin
67 rustup target add x86_64-apple-darwin
68 rustup target add wasm32-wasi
69
70 - name: Install Node
71 uses: actions/setup-node@v2
72 with:
73 node-version: '16'
74
75 - name: Checkout repo
76 uses: actions/checkout@v2
77 with:
78 clean: false
79 submodules: 'recursive'
80
81 - name: Determine version and release channel
82 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
83 run: |
84 set -eu
85
86 version=$(script/get-crate-version zed)
87 channel=$(cat crates/zed/RELEASE_CHANNEL)
88 echo "Publishing version: ${version} on release channel ${channel}"
89 echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
90
91 expected_tag_name=""
92 case ${channel} in
93 stable)
94 expected_tag_name="v${version}";;
95 preview)
96 expected_tag_name="v${version}-pre";;
97 *)
98 echo "can't publish a release on channel ${channel}"
99 exit 1;;
100 esac
101 if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
102 echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
103 exit 1
104 fi
105
106 - name: Create app bundle
107 run: script/bundle
108
109 - name: Upload app bundle to workflow run if main branch
110 uses: actions/upload-artifact@v2
111 if: ${{ github.ref == 'refs/heads/main' }}
112 with:
113 name: Zed.dmg
114 path: target/release/Zed.dmg
115
116 - uses: softprops/action-gh-release@v1
117 name: Upload app bundle to release
118 if: ${{ env.RELEASE_CHANNEL }}
119 with:
120 draft: true
121 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
122 files: target/release/Zed.dmg
123 body: ""
124 env:
125 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}