Skip to content
Open
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
126 changes: 76 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,61 +18,87 @@ jobs:
name: Go
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Check out code
uses: actions/checkout@v5

- name: Check spelling
uses: crate-ci/typos@master
- name: Check spelling
uses: crate-ci/typos@master

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: false
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: "go.mod"
cache: false

- name: Lint
uses: golangci/golangci-lint-action@v8
with:
args: -D protogetter --timeout=5m
- name: Lint
uses: golangci/golangci-lint-action@v8
with:
args: -D protogetter --timeout=5m

js:
name: JavaScript
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5

- name: setup bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install --frozen-lockfile

- name: build
run: make build

- name: Configure npmrc auth
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}
if: github.event_name == 'release'

- name: Publish to npm
run: bun publish --access public
if: github.event_name == 'release'

python:
name: Python
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Make tag
run: |
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=v0.0.0.dev-${{ github.event.number }}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=v0.0.0-rc0" >> $GITHUB_ENV || true

- name: Package
run: |
cd python
python -m pip install setuptools wheel
python setup.py sdist bdist_wheel
env:
VERSION: ${{ env.tag }}

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
packages-dir: python/dist
if: ${{ github.event_name != 'release' }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
packages-dir: python/dist
if: ${{ github.event_name == 'release' }}
- name: Check out code
uses: actions/checkout@v5

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Make tag
run: |
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=v0.0.0.dev-${{ github.event.number }}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=v0.0.0-rc0" >> $GITHUB_ENV || true

- name: Package
run: |
cd python
python -m pip install setuptools wheel
python setup.py sdist bdist_wheel
env:
VERSION: ${{ env.tag }}

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.test_pypi_password }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
packages-dir: python/dist
if: ${{ github.event_name != 'release' }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
packages-dir: python/dist
if: ${{ github.event_name == 'release' }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ pip-delete-this-directory.txt
# see python README.md why this is required:
go/buf/
go/tests/mocks/buf

# js
node_modules/
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD))
LOCALBIN ?= $(shell pwd)/bin

all: proto generate test
all: proto generate test build

release: proto generate test
release: proto generate test build

.PHONY: proto
proto: protolint
Expand All @@ -27,3 +27,7 @@ generate:
.PHONY: test
test:
$(MAKE) -C go test

.PHONY: build
build:
make -C js build VERSION=$(VERSION)
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ extend-ignore-re = [
extend-exclude = [
"go.mod",
"go.sum",
"*.ts",
"*.js"
]
24 changes: 24 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "@metal-stack/api",
"dependencies": {
"@bufbuild/protobuf": "^2.10.1",
"@connectrpc/connect-web": "^2.1.1",
},
"devDependencies": {
"typescript": "^5.9.3",
},
},
},
"packages": {
"@bufbuild/protobuf": ["@bufbuild/[email protected]", "", {}, "sha512-ckS3+vyJb5qGpEYv/s1OebUHDi/xSNtfgw1wqKZo7MR9F2z+qXr0q5XagafAG/9O0QPVIUfST0smluYSTpYFkg=="],

"@connectrpc/connect": ["@connectrpc/[email protected]", "", { "peerDependencies": { "@bufbuild/protobuf": "^2.7.0" } }, "sha512-JzhkaTvM73m2K1URT6tv53k2RwngSmCXLZJgK580qNQOXRzZRR/BCMfZw3h+90JpnG6XksP5bYT+cz0rpUzUWQ=="],

"@connectrpc/connect-web": ["@connectrpc/[email protected]", "", { "peerDependencies": { "@bufbuild/protobuf": "^2.7.0", "@connectrpc/connect": "2.1.1" } }, "sha512-J8317Q2MaFRCT1jzVR1o06bZhDIBmU0UAzWx6xOIXzOq8+k71/+k7MUF7AwcBUX+34WIvbm5syRgC5HXQA8fOg=="],

"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
}
}
16 changes: 16 additions & 0 deletions js/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: install
install:
bun install -dd

.PHONY: clean
clean:
rm -rf metalstack

.PHONY: build
build: install
ifeq ($(CI),true)
cd .. &&\
yq e -i -o=json ".version=\"$(VERSION)\"" package.json &&\
yq e -o=json ".version" package.json
endif
cd .. && bun run build
Loading
Loading