Skip to content

Commit 571f395

Browse files
authored
Merge pull request #3 from ageha734/prerelease
chore
2 parents c3a9a3a + 38ee5aa commit 571f395

File tree

16 files changed

+243
-105
lines changed

16 files changed

+243
-105
lines changed

.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ DOTNET_ROOT = { value = "", force = true }
55
[alias]
66
build = "build --target wasm32-wasip1"
77
format = "fmt --all --check"
8-
lint = "clippy --all-targets --all-features -- -D warnings"
8+
lint = "clippy --workspace --all-targets"
9+
test = "nextest run --no-default-features"

.github/CODEOWNERS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
./.cargo/* @ageha734
2+
./.cursor/* @ageha734
3+
./.github/* @ageha734
4+
./.vscode/* @ageha734
5+
./scripts/* @ageha734
6+
./.clinerules @ageha734
7+
./.commitlint.yaml @ageha734
8+
./.dprint.json @ageha734
9+
./.editorconfig @ageha734
10+
./.gitignore @ageha734
11+
./CHANGELOG.md @github_actions
12+
./clippy.toml @ageha734
13+
./lefthook.yml @ageha734
14+
./README.md @ageha734
15+
./rust-toolchain.toml @ageha734
16+
./rustfmt.toml @ageha734

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- markdownlint-disable first-line-h1 -->
2+
3+
## Why / なぜ
4+
5+
<!-- なぜこの変更が必要なのか、背景や課題を記述してください -->
6+
<!-- Please describe why this change is necessary, including background and issues -->
7+
8+
## Goal / 目標
9+
10+
<!-- この変更によって達成したい目標を記述してください -->
11+
<!-- Please describe the goals you want to achieve with this change -->
12+
13+
## Steps to Reproduce / 動作手順書
14+
15+
<!-- この変更を適用した後の動作手順を記述してください -->
16+
<!-- Please describe the steps to reproduce after applying this change -->
17+
18+
1.
19+
2.
20+
3.
21+
22+
## Verification / 動作検証
23+
24+
<!-- 動作検証の結果を記述してください -->
25+
<!-- Please describe the results of your verification/testing -->

.github/workflows/ci.yml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,28 +104,66 @@ jobs:
104104
targets: wasm32-wasip1
105105
channel: '1.90.0'
106106
cache: true
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Build WASM Plugin
111+
run: cargo build --target wasm32-wasip1
112+
113+
- name: Verify Build Output
114+
shell: bash
115+
run: |
116+
echo "Checking for WASM files..."
117+
ls -la target/wasm32-wasip1/debug/ || echo "Debug directory not found"
118+
find target -name "*.wasm" -type f || echo "No WASM files found"
107119
108-
- id: build
109-
name: Build Proto Plugin
110-
uses: moonrepo/build-wasm-plugin@60ff6f68ae0e0b4dc4b959835cd84b8d535403c2 # v0.4.2
120+
- name: Upload Plugin Artifact
121+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
122+
with:
123+
name: plugin-${{ matrix.os }}
124+
path: target/wasm32-wasip1/debug/gcloud_plugin.wasm
125+
retention-days: 1
126+
if-no-files-found: error
111127

112128
run-e2e:
113-
needs: [run-format, run-lint, run-test]
129+
needs: [run-build, run-test]
114130

115-
runs-on: ubuntu-24.04
131+
runs-on: ${{ matrix.os }}
132+
133+
strategy:
134+
matrix:
135+
os: [ubuntu-24.04, windows-2025, macos-15]
136+
fail-fast: false
116137

117138
steps:
118139
- name: Checkout Repository
119140
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
120141

142+
- name: Download Plugin Artifact
143+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
144+
with:
145+
name: plugin-${{ matrix.os }}
146+
path: target/wasm32-wasip1/debug/
147+
148+
- name: Verify Downloaded Artifact
149+
shell: bash
150+
run: |
151+
echo "Checking downloaded files..."
152+
ls -la target/wasm32-wasip1/debug/ || echo "Debug directory not found"
153+
test -f target/wasm32-wasip1/debug/gcloud_plugin.wasm || (echo "gcloud_plugin.wasm not found" && exit 1)
154+
echo "Plugin file found successfully"
155+
121156
- name: Setup Proto
122-
uses: moonrepo/setup-proto@60ff6f68ae0e0b4dc4b959835cd84b8d535403c2 # v0.4.2
157+
uses: moonrepo/setup-toolchain@3927d571963592235146e8e0b5261206954796a2 # v0.6.0
158+
with:
159+
auto-install: true
160+
proto-version: '0.53.2'
123161

124162
- name: Run E2E Tests
125163
run: proto install gcloud-test
126164

127165
- name: Run Versions Test
128-
run: gcloud-test versions
166+
run: gcloud version
129167

130168
run-approval:
131169
needs: [run-build, run-e2e]

.github/workflows/release.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
build:
1313
runs-on: ubuntu-24.04
1414

15+
outputs:
16+
changelog_entry: ${{ steps.build.outputs.changelog_entry }}
17+
1518
steps:
1619
- name: Checkout Repository
1720
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -24,22 +27,33 @@ jobs:
2427
cache-targets: release
2528
cache: false
2629

27-
- if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
28-
id: build
30+
- id: build
2931
name: Build Proto Plugin
3032
uses: moonrepo/build-wasm-plugin@60ff6f68ae0e0b4dc4b959835cd84b8d535403c2 # v0.4.2
3133

34+
- name: Upload Build Artifacts
35+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
36+
with:
37+
name: proto-plugin-artifacts
38+
path: builds/*
39+
retention-days: 1
40+
3241
release:
3342
needs: build
3443

35-
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
3644
runs-on: ubuntu-24.04
3745

3846
steps:
47+
- name: Download Build Artifacts
48+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
49+
with:
50+
name: proto-plugin-artifacts
51+
path: builds
52+
3953
- name: Release
4054
uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0
4155
with:
42-
artifacts: ${{ steps.build.outputs.artifacts }}
56+
artifacts: builds/*
4357
artifactErrorsFailBuild: true
4458
body: ${{ steps.build.outputs.changelog_entry }}
4559
makeLatest: true
@@ -62,10 +76,14 @@ jobs:
6276
update-changelog:
6377
needs: release
6478

65-
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
6679
runs-on: ubuntu-24.04
6780

6881
steps:
82+
- name: Checkout Repository
83+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84+
with:
85+
ref: ${{ github.event.repository.default_branch }}
86+
6987
- name: Update CHANGELOG
7088
run: |
7189
VERSION=${GITHUB_REF_NAME#v}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3-
debug/
43
target/
54

65
# These are backup files generated by rustfmt

.prototools

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
proto = "0.53.2"
2-
moon = "1.41.3"
32

43
commitlint = "0.10.1"
54
dprint = "0.50.1"

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pre-release-replacements = [
1414
crate-type = ["cdylib", "lib"]
1515

1616
[dependencies]
17-
extism-pdk = "1.4.1"
18-
proto_pdk = "0.30.1"
19-
proto_pdk_api = "0.29.1"
20-
schematic = { version = "0.18.11", default-features = false, features = ["schema"] }
17+
extism-pdk = { version = "1.4.1", optional = true }
18+
proto_pdk = { version = "0.30.1", optional = true }
19+
proto_pdk_api = { version = "0.29.1", optional = true }
20+
schematic = { version = "0.18.11", default-features = false, features = ["schema"], optional = true }
2121
serde = { version = "1.0.219", features = ["derive"] }
2222

2323
[dev-dependencies]
@@ -27,7 +27,7 @@ tokio = { version = "1.46.1", features = ["full"] }
2727

2828
[features]
2929
default = ["wasm"]
30-
wasm = []
30+
wasm = ["dep:extism-pdk", "dep:proto_pdk", "dep:proto_pdk_api", "dep:schematic"]
3131

3232
[profile.release]
3333
codegen-units = 1

lefthook.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ commit-msg:
44
- run: commitlint lint --message "$1"
55
pre-commit:
66
parallel: true
7-
jobs:
8-
- run: cargo fmt --all --check
9-
glob: '**/*.rs'
10-
- run: cargo clippy --all-targets --all-features -- -D warnings
11-
glob: '**/*.rs'
12-
- run: cargo test
13-
glob: '**/*.rs'
7+
commands:
8+
format:
9+
glob: '**/*.rs'
10+
run: cargo fmt --all --check
11+
lint:
12+
glob: '**/*.rs'
13+
run: cargo clippy --workspace --all-targets
14+
build-and-test:
15+
glob: '**/*.rs'
16+
run: cargo build --target wasm32-wasip1 && cargo nextest run --no-default-features

scripts/tag.sh

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,23 @@ check_git_status() {
8989
if ! git diff-index --quiet HEAD --; then
9090
error "Uncommitted changes found. Please commit them first."
9191
fi
92+
}
9293

93-
local branch=$(git rev-parse --abbrev-ref HEAD)
94-
if [[ "$branch" != "master" && "$branch" != "main" ]]; then
95-
warning "Current branch is '$branch'. You are trying to create a tag on a branch other than master/main."
96-
read -p "Continue? (y/N): " -n 1 -r
97-
echo
98-
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
99-
error "Processing interrupted"
100-
fi
94+
get_main_branch() {
95+
if git rev-parse --verify main >/dev/null 2>&1; then
96+
echo "main"
97+
elif git rev-parse --verify master >/dev/null 2>&1; then
98+
echo "master"
99+
else
100+
error "Neither 'main' nor 'master' branch found"
101101
fi
102102
}
103103

104104
create_tag() {
105105
local version=$1
106106
local tag_name="v$version"
107+
local current_branch=$(git rev-parse --abbrev-ref HEAD)
108+
local main_branch=$(get_main_branch)
107109

108110
if git rev-parse "$tag_name" >/dev/null 2>&1; then
109111
error "Tag '$tag_name' already exists"
@@ -114,15 +116,39 @@ create_tag() {
114116
git commit -m "chore: bump version to $version"
115117
success "Changes committed"
116118

119+
# If current branch is not main/master, execute PR workflow
120+
if [[ "$current_branch" != "$main_branch" ]]; then
121+
info "Pushing branch '$current_branch'..."
122+
git push origin "$current_branch"
123+
success "Branch pushed"
124+
125+
info "Merging PR with gh command..."
126+
if gh pr merge --auto --squash --delete-branch 2>/dev/null; then
127+
success "PR merged and branch deleted"
128+
else
129+
warning "Failed to auto-merge. Attempting manual merge..."
130+
if gh pr merge --squash --delete-branch; then
131+
success "PR merged and branch deleted"
132+
else
133+
error "Failed to merge PR. Please merge manually and run this script again."
134+
fi
135+
fi
136+
137+
info "Switching to $main_branch branch..."
138+
git checkout "$main_branch"
139+
success "Switched to $main_branch"
140+
141+
info "Pulling latest changes..."
142+
git pull origin "$main_branch"
143+
success "Pulled latest changes"
144+
fi
145+
117146
git tag -a "$tag_name" -m "Release $version"
118147
success "Tag '$tag_name' created"
119148

120-
info ""
121-
info "You can push the tag with the following command:"
122-
info " git push origin $tag_name"
123-
info ""
124-
info "Or push all tags:"
125-
info " git push origin --tags"
149+
info "Pushing tag to origin..."
150+
git push origin "$tag_name"
151+
success "Tag '$tag_name' pushed"
126152
}
127153

128154
main() {

0 commit comments

Comments
 (0)