Added cargo-about auto-install and CI steps

This commit is contained in:
Mikayla Maki 2023-01-23 12:43:19 -08:00
parent d060114f00
commit 0f0d5d5726
6 changed files with 21 additions and 8 deletions

View file

@ -41,16 +41,19 @@ jobs:
with:
clean: false
submodules: 'recursive'
- name: Run tests
run: cargo test --workspace --no-fail-fast
- name: Build collab
run: cargo build -p collab
- name: Build other binaries
run: cargo build --workspace --bins --all-features
- name: Generate license file
run: script/generate-licenses
bundle:
name: Bundle app
runs-on:
@ -109,6 +112,9 @@ jobs:
exit 1
fi
- name: Generate license file
run: script/generate-licenses
- name: Create app bundle
run: script/bundle

1
.gitignore vendored
View file

@ -9,6 +9,7 @@
/assets/themes/*.json
/assets/themes/Internal/*.json
/assets/themes/Experiments/*.json
/assets/licenses.md
**/venv
.build
Packages

View file

@ -1 +0,0 @@
Place holder

View file

@ -35,7 +35,7 @@ use search::{BufferSearchBar, ProjectSearchBar};
use serde::Deserialize;
use serde_json::to_string_pretty;
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
use std::{env, path::Path, str, sync::Arc};
use std::{borrow::Cow, env, path::Path, str, sync::Arc};
use system_specs::SystemSpecs;
use util::{channel::ReleaseChannel, paths, ResultExt};
pub use workspace;
@ -684,7 +684,9 @@ fn open_bundled_file(
.with_local_workspace(&app_state, cx, |workspace, cx| {
let project = workspace.project().clone();
let buffer = project.update(cx, |project, cx| {
let text = Assets::get(asset_path).unwrap().data;
let text = Assets::get(asset_path)
.map(|f| f.data)
.unwrap_or_else(|| Cow::Borrowed(b"File not found"));
let text = str::from_utf8(text.as_ref()).unwrap();
project
.create_buffer(text, project.languages().get_language(language), cx)

View file

@ -1,5 +1,10 @@
#!/bin/bash
cargo about generate --workspace -o assets/licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
set -e
[[ "$(cargo about --version)" == "cargo-about 0.5.2" ]] || cargo install cargo-about --locked --git https://github.com/zed-industries/cargo-about --branch error-code-on-warn
cargo about generate --fail-on-missing-license -o assets/licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
# cargo about automatically html-escapes all output, so we need to undo it here:
sed -i '' 's/"/"/g' assets/licenses.md
@ -7,4 +12,4 @@ sed -i '' 's/'/'\''/g' assets/licenses.md # `'\''` ends the string, appends
sed -i '' 's/=/=/g' assets/licenses.md
sed -i '' 's/`/`/g' assets/licenses.md
sed -i '' 's/&lt;/</g' assets/licenses.md
sed -i '' 's/&gt;/>/g' assets/licenses.md
sed -i '' 's/&gt;/>/g' assets/licenses.md

View file

@ -34,4 +34,4 @@ checksum = '5b698ca13897be3afdb7174256fa1574f8c6892b8bea1a66dd6469d3fe27885a'
license = "BSD-3-Clause"
[[fuchsia-cprng.clarify.files]]
path = 'LICENSE'
checksum = '03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b'
checksum = '03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b'