mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 02:37:05 +00:00
127 lines
3.4 KiB
YAML
127 lines
3.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0
|
|
RUST_BACKTRACE: 1
|
|
|
|
jobs:
|
|
tests:
|
|
name: Run tests
|
|
runs-on:
|
|
- self-hosted
|
|
- test
|
|
env:
|
|
RUSTFLAGS: -D warnings
|
|
steps:
|
|
- name: Install Rust
|
|
run: |
|
|
rustup set profile minimal
|
|
rustup update stable
|
|
rustup target add wasm32-wasi
|
|
|
|
- name: Install Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
clean: false
|
|
submodules: 'recursive'
|
|
|
|
- name: Run tests
|
|
run: cargo test --workspace --no-fail-fast
|
|
|
|
- name: Build collab binaries
|
|
run: cargo build --bins --all-features
|
|
|
|
bundle:
|
|
name: Bundle app
|
|
runs-on:
|
|
- self-hosted
|
|
- bundle
|
|
env:
|
|
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
|
|
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
|
|
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
|
|
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
|
|
ZED_AMPLITUDE_API_KEY: ${{ secrets.ZED_AMPLITUDE_API_KEY }}
|
|
ZED_MIXPANEL_TOKEN: ${{ secrets.ZED_MIXPANEL_TOKEN }}
|
|
steps:
|
|
- name: Install Rust
|
|
run: |
|
|
rustup set profile minimal
|
|
rustup update stable
|
|
rustup target add aarch64-apple-darwin
|
|
rustup target add x86_64-apple-darwin
|
|
rustup target add wasm32-wasi
|
|
|
|
- name: Install Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
clean: false
|
|
submodules: 'recursive'
|
|
|
|
- name: Determine version and release channel
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
run: |
|
|
set -eu
|
|
|
|
version=$(script/get-crate-version zed)
|
|
channel=$(cat crates/zed/RELEASE_CHANNEL)
|
|
echo "Publishing version: ${version} on release channel ${channel}"
|
|
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
|
|
|
|
expected_tag_name=""
|
|
case ${channel} in
|
|
stable)
|
|
expected_tag_name="v${version}";;
|
|
preview)
|
|
expected_tag_name="v${version}-pre";;
|
|
*)
|
|
echo "can't publish a release on channel ${channel}"
|
|
exit 1;;
|
|
esac
|
|
if [[ $GITHUB_REFNAME != $expected_tag_name ]]; then
|
|
echo "invalid release tag ${GITHUB_REFNAME}. expected ${expected_tag_name}"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create app bundle
|
|
run: script/bundle
|
|
|
|
- name: Upload app bundle to workflow run if main branch
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
with:
|
|
name: Zed.dmg
|
|
path: target/release/Zed.dmg
|
|
|
|
- uses: softprops/action-gh-release@v1
|
|
name: Upload app bundle to release
|
|
if: ${{ github.env.RELEASE_CHANNEL }}
|
|
with:
|
|
draft: true
|
|
prerelease: ${{ github.env.RELEASE_CHANNEL == 'preview' }}
|
|
files: target/release/Zed.dmg
|
|
overwrite: true
|
|
body: ""
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|