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