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