-
Notifications
You must be signed in to change notification settings - Fork 4
/
.omni.yaml
100 lines (81 loc) · 2.7 KB
/
.omni.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
up:
- rust
- node: auto
- any:
- nix:
- bats
- homebrew:
install:
- bats
commands:
create-tag:
desc: Create a new version tag for omni
run: |
set -e
# Get the last created tag
last_tag=$(git describe --tags --abbrev=0 --always)
# Extract the version number from the tag
version=$(echo "$last_tag" | sed -E 's/v([0-9]+\.[0-9]+\.[0-9]+)/\1/')
# Split the version number into its components
IFS='.' read -r -a version_parts <<< "$version"
# Increment the last component of the version number
next_version="${version_parts[0]}.${version_parts[1]}.$((${version_parts[2]} + 1))"
# Generate the tag name with the incremented version number
new_tag="v$next_version"
# Generate the annotation message using git log
changelog=$(git log --pretty=format:"- %s (%an)" "$last_tag"..HEAD)
# Create the annotated tag with the generated message
git tag -a "$new_tag" -m "$changelog"
echo "Created tag: $new_tag"
website-dev:
desc: |
Starts a local development server for the website
This opens up a browser window once the server is started.
Most changes are reflected live without having to restart the server.
dir: website
run: |
yarn start
cargo-package:
desc: Runs cargo package after overriding the version
run: |
# Check if git is dirty
[ -z "$(git status --short 2>/dev/null)" ] || {
echo "Repository dirty. Please stash all before running."
exit 1
}
# Get version
OMNI_RELEASE_VERSION=$(git describe --tags --broken --dirty --match v*)
if [ -z "$OMNI_RELEASE_VERSION" ]; then
OMNI_RELEASE_VERSION=0.0.0-$(git describe --tags --always --broken --dirty --match v*)
fi
OMNI_RELEASE_VERSION=${OMNI_RELEASE_VERSION#v}
export OMNI_RELEASE_VERSION
# Override Cargo.toml version entry
sed -i 's/^version = "0\.0\.0-git"$/version = "'"${OMNI_RELEASE_VERSION}"'"/' Cargo.toml
# Run Cargo package
cargo package --allow-dirty
# Reset Cargo.toml
git checkout Cargo.toml
lint:
desc: Runs the linter
aliases:
- clippy
run: |
# cargo fmt -- --check
cargo clippy --all-features
test:
desc: Runs the tests
run: |
cargo test
GENERATE_FIXTURES=false bats tests/
subcommands:
generate:
desc: Generates the fixtures for the tests
run: |
GENERATE_FIXTURES=true bats --filter-tags generate tests/
fix:
desc: Fixes the code
run: |
cargo fix --all-features --color always --allow-dirty
cargo clippy --fix --all-features --color always --allow-dirty
cargo fmt