1name: CI
2
3on:
4 push:
5 branches:
6 - main
7 - "v*"
8 tags:
9 - "v*"
10 pull_request:
11 branches:
12 - "**"
13
14env:
15 CARGO_TERM_COLOR: always
16 CARGO_INCREMENTAL: 0
17 RUST_BACKTRACE: 1
18
19jobs:
20 tests:
21 name: Run tests
22 runs-on:
23 - self-hosted
24 - test
25 env:
26 RUSTFLAGS: -D warnings
27 steps:
28 - name: Install Rust
29 run: |
30 rustup set profile minimal
31 rustup update stable
32 rustup target add wasm32-wasi
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 submodules: 'recursive'
44
45 - name: Run tests
46 run: cargo test --workspace --no-fail-fast
47
48 - name: Build collab binaries
49 run: cargo build --bins --all-features
50
51 bundle:
52 name: Bundle app
53 runs-on:
54 - self-hosted
55 - bundle
56 if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
57 needs: tests
58 env:
59 MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
60 MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
61 APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
62 APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
63 ZED_AMPLITUDE_API_KEY: ${{ secrets.ZED_AMPLITUDE_API_KEY }}
64 ZED_MIXPANEL_TOKEN: ${{ secrets.ZED_MIXPANEL_TOKEN }}
65 steps:
66 - name: Install Rust
67 run: |
68 rustup set profile minimal
69 rustup update stable
70 rustup target add aarch64-apple-darwin
71 rustup target add x86_64-apple-darwin
72 rustup target add wasm32-wasi
73
74 - name: Install Node
75 uses: actions/setup-node@v2
76 with:
77 node-version: '16'
78
79 - name: Checkout repo
80 uses: actions/checkout@v2
81 with:
82 clean: false
83 submodules: 'recursive'
84
85 - name: Determine version and release channel
86 if: ${{ startsWith(github.ref, 'refs/tags/v') }}
87 run: |
88 set -eu
89
90 version=$(script/get-crate-version zed)
91 channel=$(cat crates/zed/RELEASE_CHANNEL)
92 echo "Publishing version: ${version} on release channel ${channel}"
93 echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
94
95 expected_tag_name=""
96 case ${channel} in
97 stable)
98 expected_tag_name="v${version}";;
99 preview)
100 expected_tag_name="v${version}-pre";;
101 *)
102 echo "can't publish a release on channel ${channel}"
103 exit 1;;
104 esac
105 if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
106 echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
107 exit 1
108 fi
109
110 - name: Create app bundle
111 run: script/bundle
112
113 - name: Upload app bundle to workflow run if main branch
114 uses: actions/upload-artifact@v2
115 if: ${{ github.ref == 'refs/heads/main' }}
116 with:
117 name: Zed.dmg
118 path: target/release/Zed.dmg
119
120 - uses: softprops/action-gh-release@v1
121 name: Upload app bundle to release
122 if: ${{ env.RELEASE_CHANNEL }}
123 with:
124 draft: true
125 prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
126 files: target/release/Zed.dmg
127 body: ""
128 env:
129 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}