-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (124 loc) · 4.76 KB
/
Copy pathrust.yml
File metadata and controls
136 lines (124 loc) · 4.76 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
build:
name: Build and test (${{ matrix.name }})
runs-on: ubicloud-standard-2
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: default
args: ""
- name: versioned-publication
args: "--features versioned-row-publication"
- name: all-features
args: "--all-features"
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
- name: Build
run: cargo build --workspace --all-targets ${{ matrix.args }} --verbose
- name: Run tests
run: cargo test --workspace --all-targets ${{ matrix.args }} --verbose
clippy_check:
name: Clippy (${{ matrix.name }})
runs-on: ubicloud-standard-2
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: default
args: ""
- name: all-features
args: "--all-features"
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
- name: Clippy (deny warnings)
run: cargo clippy --workspace --all-targets ${{ matrix.args }} -- -D warnings
duplicate_index_crates:
name: One version of each shared index crate
runs-on: ubicloud-standard-2
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
# Two versions of WorkTablesIndex in one graph split the type identity of
# `Pair` and `ChangeEvent`, and the build then fails with "expected
# ChangeEvent<Pair<T, Link>>, found a different ChangeEvent<Pair<T,
# Link>>" across dozens of unrelated-looking lines. It happens whenever
# data_bucket and worktable disagree about which version they want, which
# is every time one is bumped and released without the other.
#
# The caret requirements are correct and stay. This turns the mismatch
# into one named failure instead of a wall of trait errors, which is the
# guard WT-8 asked for.
- name: Refuse a duplicated WorkTablesIndex or data_bucket
run: |
duplicates=$(cargo tree --duplicates --edges normal 2>/dev/null \
| grep -E '^(WorkTablesIndex|data_bucket) v' | sort -u)
if [ -n "$duplicates" ]; then
echo "More than one version of a shared index crate is in the graph:"
echo "$duplicates"
echo
echo "WorkTablesIndex, data_bucket and worktable move as one train."
echo "Publish them in lockstep, or pin them to agree."
exit 1
fi
echo "one version of each: ok"
publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [build, clippy_check, duplicate_index_crates]
runs-on: ubicloud-standard-2
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish when master carries a new version
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then echo "CARGO_REGISTRY_TOKEN not set; skipping publish"; exit 0; fi
# Publish in dependency order. worktable_codegen depends on
# worktable_dsl and worktable depends on worktable_codegen, both by
# path with an exact version, so each must be on the registry before
# the next is packaged. Omitting worktable_dsl here is what made
# `cargo publish -p worktable_codegen` fail with "no matching package
# named `worktable_dsl` found" the moment the DSL extraction landed.
publish_if_new() {
crate="$1"
manifest="$2"
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' "$manifest" | head -1)
# crates.io index paths: four or more characters is {first two}/{next two}/{name}.
if curl -fsSL "https://index.crates.io/wo/rk/$crate" \
| sed -n 's/.*"vers":"\([^"]*\)".*/\1/p' | grep -qx "$version"; then
echo "$crate $version is already on crates.io; skipping"
return 0
fi
echo "publishing $crate $version"
cargo publish -p "$crate"
}
publish_if_new worktable_dsl dsl/Cargo.toml
publish_if_new worktable_codegen codegen/Cargo.toml
publish_if_new worktable Cargo.toml