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