Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: setup crate release pipeline #283

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 113 additions & 48 deletions .github/workflows/wrpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@ on:
branches:
- main
tags:
- 'runtime-wasmtime-v[0-9].[0-9]+.[0-9]+'
- 'runtime-wasmtime-v[0-9].[0-9]+.[0-9]+-*'
- 'transport-nats-v[0-9].[0-9]+.[0-9]+'
- 'transport-nats-v[0-9].[0-9]+.[0-9]+-*'
- 'transport-v[0-9].[0-9]+.[0-9]+'
- 'transport-v[0-9].[0-9]+.[0-9]+-*'
- 'crates/cli/v[0-9].[0-9]+.[0-9]+'
- 'crates/cli/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/introspect/v[0-9].[0-9]+.[0-9]+'
- 'crates/introspect/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/runtime-wasmtime/v[0-9].[0-9]+.[0-9]+'
- 'crates/runtime-wasmtime/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/transport-nats/v[0-9].[0-9]+.[0-9]+'
- 'crates/transport-nats/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/transport-quic/v[0-9].[0-9]+.[0-9]+'
- 'crates/transport-quic/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/transport/v[0-9].[0-9]+.[0-9]+'
- 'crates/transport/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/wasmtime-nats-cli/v[0-9].[0-9]+.[0-9]+'
- 'crates/wasmtime-nats-cli/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/wit-bindgen/v[0-9].[0-9]+.[0-9]+'
- 'crates/wit-bindgen/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/wit-bindgen-go/v[0-9].[0-9]+.[0-9]+'
- 'crates/wit-bindgen-go/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/wit-bindgen-rust/v[0-9].[0-9]+.[0-9]+'
- 'crates/wit-bindgen-rust/v[0-9].[0-9]+.[0-9]+-*'
- 'crates/wit-bindgen-rust-macro/v[0-9].[0-9]+.[0-9]+'
- 'crates/wit-bindgen-rust-macro/v[0-9].[0-9]+.[0-9]+-*'
- 'v[0-9].[0-9]+.[0-9]+'
- 'v[0-9].[0-9]+.[0-9]+-*'
workflow_dispatch:
Expand Down Expand Up @@ -150,6 +166,74 @@ jobs:
if: ${{ matrix.check }} == "nextest"
- run: nix build -L .#checks.x86_64-linux.${{ matrix.check }}

crates:
strategy:
matrix:
include:
- crate: cli

- crate: introspect

- crate: runtime-wasmtime
workspace-dependencies: true

- crate: transport

- crate: transport-nats
workspace-dependencies: true

- crate: transport-quic
workspace-dependencies: true

- crate: wasmtime-nats-cli
workspace-dependencies: true

- crate: wit-bindgen
workspace-dependencies: true

- crate: wit-bindgen-go
workspace-dependencies: true

- crate: wit-bindgen-rust
workspace-dependencies: true

- crate: wit-bindgen-rust-macro
workspace-dependencies: true

name: publish ${{ matrix.crate }} to crates.io
needs: cargo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Extract tag context
id: ctx
run: |
version=${GITHUB_REF_NAME#crates/${{ matrix.crate }}/v}
echo "version is ${version}"
if [[ $version == *"-"* ]]; then
echo "version ${version} is a pre-release"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi

- name: dry-run publish ${{ matrix.crate }} to crates.io
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
continue-on-error: ${{ matrix.workspace-dependencies }} # publish may fail due to workspace crates not being published yet
run: cargo publish --dry-run
working-directory: ./crates/${{ matrix.crate }}

- name: publish ${{ matrix.crate }} to crates.io
if: startsWith(github.ref, format('refs/tags/crates/{0}/v', matrix.crate)) && !steps.ctx.outputs.prerelease
continue-on-error: ${{ github.repository_owner != 'wrpc' }}
run: |
pkgver=$(cargo pkgid | cut -d '@' -f 2)
if ![ "$pkgver" = "${{ steps.ctx.outputs.version }}" ]; then
echo "version mismatch, $pkgver (package) != ${{ steps.ctx.outputs.version }} (tag)"
exit 1
fi
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
working-directory: ./crates/${{ matrix.crate }}

build-doc:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -265,6 +349,7 @@ jobs:
- build-doc
- build-lipo
- cargo
- crates
- oci
- test-linux
- test-windows
Expand All @@ -273,9 +358,31 @@ jobs:
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Extract tag context
id: ctx
run: |
version=${GITHUB_REF_NAME#v}
echo "version is ${version}"
if [[ $version == *"-"* ]]; then
echo "version ${version} is a pre-release"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi

- name: publish wRPC to crates.io
if: startsWith(github.ref, 'refs/tags/v')
run: |
pkgver=$(cargo pkgid | cut -d '@' -f 2)
if ![ "$pkgver" = "${{ steps.ctx.outputs.version }}" ]; then
echo "version mismatch, $pkgver (package) != ${{ steps.ctx.outputs.version }} (tag)"
exit 1
fi
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: artifacts

- run: |
for dir in ./artifacts/wrpc-*; do
target=${dir#./artifacts/wrpc-}
Expand Down Expand Up @@ -306,45 +413,3 @@ jobs:
./wit-bindgen-wrpc/*
./wrpc-wasmtime-nats/*

crates:
strategy:
matrix:
include:
- crate: introspect

- crate: runtime-wasmtime
workspace-dependencies: true

- crate: transport
workspace-dependencies: true

- crate: transport-nats
workspace-dependencies: true

name: publish ${{ matrix.crate }} to crates.io
needs: cargo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Extract tag context
id: ctx
run: |
version=${GITHUB_REF_NAME#${{ matrix.crate }}-v}
echo "version is ${version}"
if [[ $version == *"-"* ]]; then
echo "version ${version} is a pre-release"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi

- name: dry-run publish ${{ matrix.crate }} to crates.io
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
continue-on-error: ${{ matrix.workspace-dependencies }} # publish may fail due to workspace crates not being published yet
run: cargo publish --dry-run
working-directory: ./crates/${{ matrix.crate }}

- name: publish ${{ matrix.crate }} to crates.io
if: startsWith(github.ref, format('refs/tags/{0}-v', matrix.crate)) && !steps.ctx.outputs.prerelease
continue-on-error: ${{ github.repository_owner != 'wrpc' }}
run: cargo publish --token ${{ secrets.CRATES_PUBLISH_TOKEN }}
working-directory: ./crates/${{ matrix.crate }}
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
description = "WebAssembly component-native RPC framework based on WIT"
name = "wrpc"
version = "0.8.1"
version = "0.9.0"

authors.workspace = true
categories.workspace = true
Expand Down Expand Up @@ -130,10 +130,10 @@ wasmtime = { version = "24", default-features = false }
wasmtime-wasi = { version = "24", default-features = false }
wit-bindgen = { version = "0.30", default-features = false }
wit-bindgen-core = { version = "0.30", default-features = false }
wit-bindgen-wrpc = { version = "0.6.3", default-features = false, path = "./crates/wit-bindgen" }
wit-bindgen-wrpc-go = { version = "0.7", default-features = false, path = "./crates/wit-bindgen-go" }
wit-bindgen-wrpc-rust = { version = "0.6.3", default-features = false, path = "./crates/wit-bindgen-rust" }
wit-bindgen-wrpc-rust-macro = { version = "0.6.3", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
wit-bindgen-wrpc = { version = "0.6.4", default-features = false, path = "./crates/wit-bindgen" }
wit-bindgen-wrpc-go = { version = "0.8", default-features = false, path = "./crates/wit-bindgen-go" }
wit-bindgen-wrpc-rust = { version = "0.6.4", default-features = false, path = "./crates/wit-bindgen-rust" }
wit-bindgen-wrpc-rust-macro = { version = "0.6.4", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
wit-component = { version = "0.215", default-features = false }
wit-parser = { version = "0.215", default-features = false }
wrpc-cli = { version = "0.2.1", path = "./crates/cli", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-go/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc-go"
version = "0.7.0"
version = "0.8.0"
description = """
Go bindings generator for wRPC
"""
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-rust-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc-rust-macro"
version = "0.6.3"
version = "0.6.4"
description = """
Procedural macro paired with the `wit-bindgen-wrpc` crate.
"""
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc-rust"
version = "0.6.3"
version = "0.6.4"
description = """
Rust bindings generator for wRPC, typically used through
the `wit-bindgen-wrpc` crate's `generate!` macro.
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc"
version = "0.6.3"
version = "0.6.4"
description = """
Rust bindings generator for wRPC.
"""
Expand Down
4 changes: 2 additions & 2 deletions examples/go/hello-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.2

require (
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -15,4 +15,4 @@ require (
golang.org/x/sys v0.20.0 // indirect
)

replace wrpc.io/go v0.0.2 => ../../../go
replace wrpc.io/go v0.0.3 => ../../../go
4 changes: 2 additions & 2 deletions examples/go/hello-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.2

require (
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -15,4 +15,4 @@ require (
golang.org/x/sys v0.20.0 // indirect
)

replace wrpc.io/go v0.0.2 => ../../../go
replace wrpc.io/go v0.0.3 => ../../../go
4 changes: 2 additions & 2 deletions examples/go/resources-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.2
require (
github.com/google/uuid v1.6.0
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -16,4 +16,4 @@ require (
golang.org/x/sys v0.20.0 // indirect
)

replace wrpc.io/go v0.0.2 => ../../../go
replace wrpc.io/go v0.0.3 => ../../../go
4 changes: 2 additions & 2 deletions examples/go/streams-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.2

require (
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -15,4 +15,4 @@ require (
golang.org/x/sys v0.20.0 // indirect
)

replace wrpc.io/go v0.0.2 => ../../../go
replace wrpc.io/go v0.0.3 => ../../../go
4 changes: 2 additions & 2 deletions examples/go/streams-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.2

require (
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -15,4 +15,4 @@ require (
golang.org/x/sys v0.20.0 // indirect
)

replace wrpc.io/go v0.0.2 => ../../../go
replace wrpc.io/go v0.0.3 => ../../../go
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ use (
./tests/go
)

replace wrpc.io/go v0.0.2 => ./go
replace wrpc.io/go v0.0.3 => ./go
4 changes: 2 additions & 2 deletions tests/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/google/uuid v1.6.0
github.com/nats-io/nats-server/v2 v2.10.14
github.com/nats-io/nats.go v1.37.0
wrpc.io/go v0.0.2
wrpc.io/go v0.0.3
)

require (
Expand All @@ -24,4 +24,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace wrpc.io/go v0.0.2 => ../../go
replace wrpc.io/go v0.0.3 => ../../go
Loading