Skip to content

Commit 9bc9956

Browse files
committed
Re-add subtree x86_vlapic after history repair
git-subtree-dir: components/x86_vlapic git-subtree-mainline: 4e138aad077ba24237e492c7f9d82b8e49950573 git-subtree-split: 536f610
0 parents  commit 9bc9956

30 files changed

+3874
-0
lines changed

.github/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"targets": [
3+
"x86_64-unknown-none"
4+
],
5+
"rust_components": [
6+
"rust-src",
7+
"clippy",
8+
"rustfmt"
9+
]
10+
}

.github/workflows/check.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Quality Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
pull_request:
10+
workflow_call:
11+
12+
jobs:
13+
load-config:
14+
name: Load CI Configuration
15+
runs-on: ubuntu-latest
16+
outputs:
17+
targets: ${{ steps.config.outputs.targets }}
18+
rust_components: ${{ steps.config.outputs.rust_components }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Load configuration
24+
id: config
25+
run: |
26+
TARGETS=$(jq -c '.targets' .github/config.json)
27+
COMPONENTS=$(jq -r '.rust_components | join(", ")' .github/config.json)
28+
29+
echo "targets=$TARGETS" >> $GITHUB_OUTPUT
30+
echo "rust_components=$COMPONENTS" >> $GITHUB_OUTPUT
31+
32+
check:
33+
name: Check
34+
runs-on: ubuntu-latest
35+
needs: load-config
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
target: ${{ fromJson(needs.load-config.outputs.targets) }}
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Install Rust toolchain
46+
uses: dtolnay/rust-toolchain@nightly
47+
with:
48+
components: ${{ needs.load-config.outputs.rust_components }}
49+
targets: ${{ matrix.target }}
50+
51+
- name: Check rust version
52+
run: rustc --version --verbose
53+
54+
- name: Check code format
55+
run: cargo fmt --all -- --check
56+
57+
- name: Build
58+
run: cargo build --target ${{ matrix.target }} --all-features
59+
60+
- name: Run clippy
61+
run: cargo clippy --target ${{ matrix.target }} --all-features -- -D warnings
62+
63+
- name: Build documentation
64+
env:
65+
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs
66+
run: cargo doc --no-deps --target ${{ matrix.target }} --all-features

.github/workflows/deploy.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: false
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
RUST_BACKTRACE: 1
20+
21+
jobs:
22+
verify-tag:
23+
name: Verify Tag
24+
runs-on: ubuntu-latest
25+
outputs:
26+
should_deploy: ${{ steps.check.outputs.should_deploy }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Check if tag is on main or master branch
34+
id: check
35+
run: |
36+
git fetch origin main master || true
37+
BRANCHES=$(git branch -r --contains ${{ github.ref }})
38+
39+
if echo "$BRANCHES" | grep -qE 'origin/(main|master)'; then
40+
echo "✓ Tag is on main or master branch"
41+
echo "should_deploy=true" >> $GITHUB_OUTPUT
42+
else
43+
echo "✗ Tag is not on main or master branch, skipping deployment"
44+
echo "Tag is on: $BRANCHES"
45+
echo "should_deploy=false" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Verify version consistency
49+
if: steps.check.outputs.should_deploy == 'true'
50+
run: |
51+
# Extract version from git tag (remove 'v' prefix)
52+
TAG_VERSION="${{ github.ref_name }}"
53+
TAG_VERSION="${TAG_VERSION#v}"
54+
# Extract version from Cargo.toml
55+
CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)"/\1/')
56+
echo "Git tag version: $TAG_VERSION"
57+
echo "Cargo.toml version: $CARGO_VERSION"
58+
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
59+
echo "ERROR: Version mismatch! Tag version ($TAG_VERSION) != Cargo.toml version ($CARGO_VERSION)"
60+
exit 1
61+
fi
62+
echo "✓ Version check passed!"
63+
64+
check:
65+
uses: ./.github/workflows/check.yml
66+
needs: verify-tag
67+
if: needs.verify-tag.outputs.should_deploy == 'true'
68+
69+
test:
70+
uses: ./.github/workflows/test.yml
71+
needs: verify-tag
72+
if: needs.verify-tag.outputs.should_deploy == 'true'
73+
74+
build:
75+
name: Build documentation
76+
runs-on: ubuntu-latest
77+
needs: [verify-tag, check, test]
78+
if: needs.verify-tag.outputs.should_deploy == 'true'
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v4
82+
83+
- name: Install Rust toolchain
84+
uses: dtolnay/rust-toolchain@nightly
85+
86+
- name: Build docs
87+
env:
88+
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs
89+
run: |
90+
# Build documentation
91+
cargo doc --no-deps --all-features
92+
93+
# Auto-detect documentation directory
94+
# Check if doc exists in target/doc or target/*/doc
95+
if [ -d "target/doc" ]; then
96+
DOC_DIR="target/doc"
97+
else
98+
# Find doc directory under target/*/doc pattern
99+
DOC_DIR=$(find target -type d -name doc -path "target/*/doc" | head -n 1)
100+
if [ -z "$DOC_DIR" ]; then
101+
echo "Error: Could not find documentation directory"
102+
exit 1
103+
fi
104+
fi
105+
106+
echo "Documentation found in: $DOC_DIR"
107+
printf '<meta http-equiv="refresh" content="0;url=%s/index.html">' $(cargo tree | head -1 | cut -d' ' -f1) > "${DOC_DIR}/index.html"
108+
echo "DOC_DIR=${DOC_DIR}" >> $GITHUB_ENV
109+
110+
- name: Upload artifact
111+
uses: actions/upload-pages-artifact@v3
112+
with:
113+
path: ${{ env.DOC_DIR }}
114+
115+
deploy:
116+
name: Deploy to GitHub Pages
117+
environment:
118+
name: github-pages
119+
url: ${{ steps.deployment.outputs.page_url }}
120+
runs-on: ubuntu-latest
121+
needs: [verify-tag, build]
122+
if: needs.verify-tag.outputs.should_deploy == 'true'
123+
steps:
124+
- name: Deploy to GitHub Pages
125+
id: deployment
126+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+-pre.[0-9]+'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
verify-tag:
14+
name: Verify Tag
15+
runs-on: ubuntu-latest
16+
outputs:
17+
should_release: ${{ steps.check.outputs.should_release }}
18+
is_prerelease: ${{ steps.check.outputs.is_prerelease }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Check tag type and branch
26+
id: check
27+
run: |
28+
git fetch origin main master dev || true
29+
30+
TAG="${{ github.ref_name }}"
31+
BRANCHES=$(git branch -r --contains ${{ github.ref }})
32+
33+
echo "Tag: $TAG"
34+
echo "Branches containing this tag: $BRANCHES"
35+
36+
# Check if it's a prerelease tag
37+
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-pre\.[0-9]+$ ]]; then
38+
echo "📦 Detected prerelease tag"
39+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
40+
41+
if echo "$BRANCHES" | grep -q 'origin/dev'; then
42+
echo "✓ Prerelease tag is on dev branch"
43+
echo "should_release=true" >> $GITHUB_OUTPUT
44+
else
45+
echo "✗ Prerelease tag must be on dev branch, skipping release"
46+
echo "should_release=false" >> $GITHUB_OUTPUT
47+
fi
48+
elif [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
49+
echo "📦 Detected stable release tag"
50+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
51+
52+
if echo "$BRANCHES" | grep -qE 'origin/(main|master)'; then
53+
echo "✓ Stable release tag is on main or master branch"
54+
echo "should_release=true" >> $GITHUB_OUTPUT
55+
else
56+
echo "✗ Stable release tag must be on main or master branch, skipping release"
57+
echo "should_release=false" >> $GITHUB_OUTPUT
58+
fi
59+
else
60+
echo "✗ Unknown tag format, skipping release"
61+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
62+
echo "should_release=false" >> $GITHUB_OUTPUT
63+
fi
64+
65+
- name: Verify version consistency
66+
if: steps.check.outputs.should_release == 'true'
67+
run: |
68+
# Extract version from git tag (remove 'v' prefix)
69+
TAG_VERSION="${{ github.ref_name }}"
70+
TAG_VERSION="${TAG_VERSION#v}"
71+
# Extract version from Cargo.toml
72+
CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)"/\1/')
73+
echo "Git tag version: $TAG_VERSION"
74+
echo "Cargo.toml version: $CARGO_VERSION"
75+
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
76+
echo "ERROR: Version mismatch! Tag version ($TAG_VERSION) != Cargo.toml version ($CARGO_VERSION)"
77+
exit 1
78+
fi
79+
echo "✓ Version check passed!"
80+
81+
check:
82+
uses: ./.github/workflows/check.yml
83+
needs: verify-tag
84+
if: needs.verify-tag.outputs.should_release == 'true'
85+
86+
test:
87+
uses: ./.github/workflows/test.yml
88+
needs: [verify-tag, check]
89+
if: needs.verify-tag.outputs.should_release == 'true'
90+
91+
release:
92+
name: Create GitHub Release
93+
runs-on: ubuntu-latest
94+
needs: [verify-tag, check]
95+
if: needs.verify-tag.outputs.should_release == 'true'
96+
97+
steps:
98+
- name: Checkout code
99+
uses: actions/checkout@v4
100+
with:
101+
fetch-depth: 0
102+
103+
- name: Generate release notes
104+
id: release_notes
105+
run: |
106+
CURRENT_TAG="${{ github.ref_name }}"
107+
108+
# Get previous tag
109+
PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -A1 "^${CURRENT_TAG}$" | tail -n1)
110+
111+
if [ -z "$PREVIOUS_TAG" ] || [ "$PREVIOUS_TAG" == "$CURRENT_TAG" ]; then
112+
echo "No previous tag found, this is the first release"
113+
CHANGELOG="Initial release"
114+
else
115+
echo "Generating changelog from $PREVIOUS_TAG to $CURRENT_TAG"
116+
117+
# Generate changelog with commit messages
118+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" "${PREVIOUS_TAG}..${CURRENT_TAG}")
119+
120+
if [ -z "$CHANGELOG" ]; then
121+
CHANGELOG="No changes"
122+
fi
123+
fi
124+
125+
# Write changelog to output file (multi-line)
126+
{
127+
echo "changelog<<EOF"
128+
echo "$CHANGELOG"
129+
echo "EOF"
130+
} >> $GITHUB_OUTPUT
131+
132+
- name: Create GitHub Release
133+
uses: softprops/action-gh-release@v2
134+
with:
135+
draft: false
136+
prerelease: ${{ needs.verify-tag.outputs.is_prerelease == 'true' }}
137+
body: |
138+
## Changes
139+
${{ steps.release_notes.outputs.changelog }}
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
143+
publish:
144+
name: Publish to crates.io
145+
runs-on: ubuntu-latest
146+
needs: [verify-tag, check]
147+
if: needs.verify-tag.outputs.should_release == 'true'
148+
149+
steps:
150+
- name: Checkout code
151+
uses: actions/checkout@v4
152+
153+
- name: Install Rust toolchain
154+
uses: dtolnay/rust-toolchain@nightly
155+
156+
- name: Dry run publish
157+
run: cargo publish --dry-run
158+
159+
- name: Publish to crates.io
160+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)