forked from Dicklesworthstone/pi_agent_rust
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (99 loc) · 3.3 KB
/
Copy pathsemver.yml
File metadata and controls
110 lines (99 loc) · 3.3 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
name: semver
"on":
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "docs/sdk.md"
- ".github/workflows/semver.yml"
push:
branches: [main]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "docs/sdk.md"
- ".github/workflows/semver.yml"
workflow_dispatch:
inputs:
baseline_rev:
description: "Optional git revision to compare against; defaults to PR base, push before-SHA, or HEAD~1."
required: false
type: string
permissions:
contents: read
concurrency:
group: semver-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_TARGET_DIR: /tmp/pi-agent-rust-semver-target
TMPDIR: /tmp/pi-agent-rust-semver-tmp
jobs:
cargo-semver-checks:
name: cargo-semver-checks
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: pi_agent_rust
shell: bash
steps:
- name: Free disk space
working-directory: /
run: |
set -euxo pipefail
df -h /
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
/opt/hostedtoolcache/CodeQL /opt/hostedtoolcache/go \
/opt/hostedtoolcache/Python /opt/hostedtoolcache/Ruby \
/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk \
/usr/local/share/powershell /usr/share/swift \
/usr/local/graalvm /usr/local/.ghcup /usr/local/julia*
sudo docker image prune --all --force || true
sudo apt-get clean || true
df -h /
- name: Checkout pi_agent_rust
uses: actions/checkout@v4
with:
path: pi_agent_rust
fetch-depth: 0
- name: Install system deps
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Prepare temp directories
run: |
set -euxo pipefail
mkdir -p "$CARGO_TARGET_DIR" "$TMPDIR"
- name: Resolve semver baseline
id: baseline
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "pull_request" ]; then
baseline_rev="${{ github.event.pull_request.base.sha }}"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.baseline_rev }}" ]; then
baseline_rev="${{ inputs.baseline_rev }}"
elif [ "${{ github.event_name }}" = "push" ]; then
baseline_rev="${{ github.event.before }}"
if [ -z "$baseline_rev" ] || [[ "$baseline_rev" =~ ^0+$ ]]; then
baseline_rev="HEAD~1"
fi
else
baseline_rev="HEAD~1"
fi
git rev-parse --verify "${baseline_rev}^{commit}" >/dev/null
echo "rev=$baseline_rev" >> "$GITHUB_OUTPUT"
echo "Using cargo-semver-checks baseline: $baseline_rev"
- name: Check public API SemVer compatibility
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
manifest-path: pi_agent_rust/Cargo.toml
package: pi_agent_rust
baseline-rev: ${{ steps.baseline.outputs.rev }}
rust-toolchain: nightly
shared-key: pi-agent-rust-semver
verbose: true