Skip to content

Commit

Permalink
move Rust and Go SDKs to their own repos (#2289)
Browse files Browse the repository at this point in the history
* move Rust and Go SDKs to their own repos

These SDKs and their examples have moved to
https://github.com/fermyon/spin-rust-sdk and
https://github.com/fermyon/spin-go-sdk, respectively.  The plan is to begin
releasing them on their own cadence, independent of Spin releases.  This will
allow us to make breaking changes in semver-compatible major releases without
tying such releases to a Spin major release, e.g. to target WASI 0.2.0.

Note that I've update the integration tests which use the Rust SDK to use the
latest stable release (2.2.0) instead of a path-based dependency.
Alternatively, we could point it at the `main` branch of the `spin-rust-sdk` Git
repo, but that will require close coordination once we start making breaking
changes to the API in that repo.

We may also want to move the Rust and Go templates to the new repos at some
point.  I've left them where they are for the time being.

Finally, I've removed the SDK-specific bits from release-process.md and the
GitHub workflows.  We'll need to move those things to their respective SDK
repos.  Reproducing the automated Go SDK tagging that feeds into the templates
may require moving at least the Go templates as noted above.

Signed-off-by: Joel Dice <[email protected]>

* restore accidentally-removed lines from release-process.md

Signed-off-by: Joel Dice <[email protected]>

* update SDK examples links to point to `stable` branches

We'll update the `stable` branch of the applicable repo each time we make a new
stable release of any of the SDKs so that these links always point to the
examples for the latest stable release rather than `main`.

Signed-off-by: Joel Dice <[email protected]>

* re-add (updated version of) `push-templates-tag` to release.yml

Unlike the original version, this one does not depend on the Go SDK automation
and instead derives the template tag name from the Spin version tag name.

Signed-off-by: Joel Dice <[email protected]>

* re-add `build-and-sign` as dependency of `push-templates-tag`

This ensures that we don't tag a broken build.

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>
  • Loading branch information
dicej authored Feb 21, 2024
1 parent 663593d commit 78f84e7
Show file tree
Hide file tree
Showing 266 changed files with 57 additions and 22,077 deletions.
7 changes: 0 additions & 7 deletions .github/gh-checktags.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

## for the release tags v*, check if
## - golang sdk tag exists
## - spin templates tag exists

set -e
Expand All @@ -23,12 +22,6 @@ for tag in $tags; do
continue
fi

# check golang sdk tag
if [[ -z "$(git tag -l sdk/go/$tag)" ]]; then
echo "tag sdk/go/$tag does not exist"
exit_code=1
fi

# remove trailing .\d+ from the version
major_minor=`echo $tag | sed 's/\.[0-9]*$//g'`

Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,36 +167,6 @@ jobs:
# Only run integration tests on macOS as they will be run on ubuntu separately
if: ${{ matrix.runner == 'macos-latest' }}

test-go:
name: Test Spin SDK - Go
runs-on: ubuntu-latest
needs: build-rust-ubuntu
steps:
- uses: actions/checkout@v3

- name: Retrieve saved Spin Binary
uses: actions/download-artifact@v3
with:
name: spin-ubuntu-latest
path: target/debug/

- name: Fix Spin Binary permissions
run: |
ls -lah target/
ls -lah target/debug
chmod +x target/debug/spin
- name: setup dependencies
uses: ./.github/actions/spin-ci-dependencies
with:
rust: true
golang: true
tinygo: true
wasmtime: true

- name: "Test Go SDK"
run: make test-sdk-go

all-integration-tests:
# run on a larger runner for more SSD/resource access
runs-on: ubuntu-22.04-4core-spin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-tags.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check tags for templates and sdk
name: Check tags for templates
on:
schedule:
- cron: '0 0 * * *'
Expand Down
91 changes: 2 additions & 89 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,84 +254,17 @@ jobs:
--title ${{ github.ref_name }} \
--generate-notes ${{ env.PRERELEASE }}
create-go-sdk-tag:
name: create tag sdk/go/v*
runs-on: ubuntu-latest
needs: build-and-sign
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3

- name: Set the tag to sdk/go/v*
shell: bash
run: echo "GO_SDK_TAG=sdk/go/${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Tag sdk/go/v* and push it
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ env.GO_SDK_TAG }}
git push origin ${{ env.GO_SDK_TAG }}
create-template-sdk-update-pr:
name: Create PR with template SDK updates
runs-on: ubuntu-latest
needs: create-go-sdk-tag
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3

- name: Set the spin tag
shell: bash
run: |
echo "SPIN_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Set the PR base branch
shell: bash
run: |
IFS=. read -r major minor patch <<< "${{ env.SPIN_TAG }}"
echo "RELEASE_BRANCH=$major.$minor" >> $GITHUB_ENV
- name: Change sdk version
shell: bash
run: |
cd templates
SDK_VERSION=${{ env.SPIN_TAG }} make
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "feat(templates): update sdk to ${{ env.SPIN_TAG }}"
title: "feat(templates): update sdk to ${{ env.SPIN_TAG }}"
body: Update the SDK version used by the templates
branch: update-sdk-${{ env.SPIN_TAG }}
base: ${{ env.RELEASE_BRANCH }}
delete-branch: true
committer: fermybot <[email protected]>
author: fermybot <[email protected]>
signoff: true

# This will run when the PR above is approved and merged into main via a merge commit
push-templates-tag:
runs-on: ubuntu-latest
needs: build-and-sign
if: github.event.commits[0].author.name == 'fermybot' && contains(github.event.commits[0].message, 'update sdk')
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3

- name: Set the tag to spin/templates/v*
shell: bash
run: |
spin_tag=$(echo "${{ github.event.commits[0].message }}" | grep -Eo v[0-9.]+)
spin_tag=$(echo "${{ github.ref }}" | grep -Eo "refs/tags/v[0-9.]+")
IFS=. read -r major minor patch <<< "${spin_tag}"
echo "TEMPLATE_TAG=spin/templates/$major.$minor" >> $GITHUB_ENV
Expand Down Expand Up @@ -431,23 +364,3 @@ jobs:
with:
name: spin
path: _dist/spin-${{ env.RELEASE_VERSION }}-static-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz

crates:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: build-and-sign
if: |
startsWith(github.ref, 'refs/tags/v') &&
github.repository_owner == 'fermyon'
steps:
- uses: actions/checkout@v2

- name: Publish spin-macro to crates.io
working-directory: ./sdk/rust/macro
run: |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish spin-sdk to crates.io
working-directory: ./sdk/rust
run: |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
132 changes: 0 additions & 132 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ llm-cublas = ["llm", "spin-trigger-http/llm-cublas"]
[workspace]
members = [
"crates/*",
"sdk/rust",
"sdk/rust/macro",
"tests/runtime-tests",
"tests/testing-framework",
]
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export PATH := target/debug:target/release:$(HOME)/.cargo/bin:$(PATH)

## overrides for Windows
ifeq ($(OS),Windows_NT)
LOG_LEVEL_VAR =
LOG_LEVEL_VAR =
endif

.PHONY: build
Expand Down Expand Up @@ -39,7 +39,7 @@ lint-all: lint lint-rust-examples

## Bring all of the checked in `Cargo.lock` files up-to-date
.PHONY: update-cargo-locks
update-cargo-locks:
update-cargo-locks:
echo "Updating Cargo.toml"
cargo update -w --offline; \
for manifest_path in $$(find examples -name Cargo.toml); do \
Expand Down Expand Up @@ -71,10 +71,6 @@ test-integration: test-runtime
test-integration-full: test-runtime-full
cargo test --release integration_tests --no-default-features --features extern-dependencies-tests --no-fail-fast -- --nocapture

.PHONY: test-sdk-go
test-sdk-go:
$(MAKE) -C sdk/go test

# simple convenience for developing with TLS
.PHONY: tls
tls: ${CERT_NAME}.crt.pem
Expand Down
Loading

0 comments on commit 78f84e7

Please sign in to comment.