mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-10-01 19:20:31 +00:00
ci: move workflows to Gitea and add client release workflow
Tests / Integration Tests (push) Failing after 1m39s
Build , Vet Test, and Lint / Build (push) Successful in 2m3s
Tests / Unit Tests (push) Successful in 2m8s
Build , Vet Test, and Lint / Lint Code (push) Successful in 2m51s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 2m57s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 2m59s
Tests / Race Detector (push) Successful in 5m9s
Tests / Integration Tests (push) Failing after 1m39s
Build , Vet Test, and Lint / Build (push) Successful in 2m3s
Tests / Unit Tests (push) Successful in 2m8s
Build , Vet Test, and Lint / Lint Code (push) Successful in 2m51s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 2m57s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 2m59s
Tests / Race Detector (push) Successful in 5m9s
Move .github/workflows to .gitea/workflows with Gitea-compatible action versions, fix make_tag outputs/major bump, and add release_clients.yml to build and publish all clients to the Gitea package registries. Rename the Go client module to git.warky.dev/wdevs and add LICENSE/CHANGELOG for Dart.
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
# This workflow will build a golang project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||
|
||||
name: Create Go Release (Tag Versioning)
|
||||
|
||||
on:
|
||||
@@ -26,7 +23,9 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Git
|
||||
run: |
|
||||
@@ -38,7 +37,7 @@ jobs:
|
||||
run: |
|
||||
git fetch --tags
|
||||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
echo "::set-output name=tag::$latest_tag"
|
||||
echo "tag=${latest_tag}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Determine new tag version
|
||||
id: new_tag
|
||||
@@ -57,7 +56,7 @@ jobs:
|
||||
((minor++))
|
||||
patch=0
|
||||
;;
|
||||
"release")
|
||||
"major")
|
||||
((major++))
|
||||
minor=0
|
||||
patch=0
|
||||
@@ -68,15 +67,11 @@ jobs:
|
||||
;;
|
||||
esac
|
||||
new_tag="v$major.$minor.$patch"
|
||||
echo "::set-output name=tag::$new_tag"
|
||||
echo "tag=${new_tag}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
git tag -a ${{ steps.new_tag.outputs.tag }} -m "Tagging ${{ steps.new_tag.outputs.tag }} for release"
|
||||
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.BITECH_GITHUB_TOKEN }}
|
||||
force: true
|
||||
tags: true
|
||||
- name: Push tag
|
||||
run: git push origin ${{ steps.new_tag.outputs.tag }}
|
||||
@@ -0,0 +1,264 @@
|
||||
name: Release Clients
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Client version (e.g. 1.4.0)"
|
||||
required: true
|
||||
type: string
|
||||
publish:
|
||||
description: "Publish packages to Gitea (untick for a build/test dry run)"
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
VERSION_INPUT: ${{ github.event.inputs.version }}
|
||||
PUBLISH: ${{ github.event.inputs.publish }}
|
||||
SERVER_URL: ${{ github.server_url }}
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
REGISTRY_USER: ${{ secrets.PACKAGE_REGISTRY_USERNAME || vars.PACKAGE_REGISTRY_USERNAME }}
|
||||
TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN || vars.PACKAGE_REGISTRY_TOKEN }}
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.v.outputs.version }}
|
||||
steps:
|
||||
- id: v
|
||||
run: |
|
||||
version="${VERSION_INPUT#v}"
|
||||
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
|
||||
echo "Invalid version: $VERSION_INPUT" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "version=${version}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
js:
|
||||
name: JS (npm)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-js
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable
|
||||
|
||||
- name: Install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Test
|
||||
run: pnpm test
|
||||
|
||||
- name: Set version
|
||||
run: npm version "$VERSION" --no-git-tag-version --allow-same-version
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
run: |
|
||||
host="${SERVER_URL#*://}"
|
||||
registry="${SERVER_URL}/api/packages/${OWNER}/npm/"
|
||||
npm config set "@warkypublic:registry" "$registry"
|
||||
npm config set "//${host}/api/packages/${OWNER}/npm/:_authToken" "$TOKEN"
|
||||
npm publish --registry "$registry"
|
||||
|
||||
python:
|
||||
name: Python (PyPI)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-python
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install
|
||||
run: pip install -e ".[dev]" build twine
|
||||
|
||||
- name: Test
|
||||
run: pytest
|
||||
|
||||
- name: Set version
|
||||
run: sed -i -E "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml
|
||||
|
||||
- name: Build
|
||||
run: python -m build
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
run: |
|
||||
twine upload \
|
||||
--repository-url "${SERVER_URL}/api/packages/${OWNER}/pypi" \
|
||||
-u "$REGISTRY_USER" -p "$TOKEN" \
|
||||
dist/*
|
||||
|
||||
rust:
|
||||
name: Rust (Cargo)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-rs
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Rust
|
||||
run: |
|
||||
rustup toolchain install stable --profile minimal
|
||||
rustup default stable
|
||||
|
||||
- name: Test
|
||||
run: cargo test
|
||||
|
||||
- name: Set version
|
||||
run: sed -i -E '0,/^version = ".*"/s//version = "'"${VERSION}"'"/' Cargo.toml
|
||||
|
||||
- name: Package
|
||||
run: cargo package --allow-dirty
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
env:
|
||||
CARGO_REGISTRIES_GITEA_INDEX: sparse+${{ github.server_url }}/api/packages/${{ github.repository_owner }}/cargo/
|
||||
run: |
|
||||
export CARGO_REGISTRIES_GITEA_TOKEN="Bearer ${TOKEN}"
|
||||
cargo publish --registry gitea --allow-dirty
|
||||
|
||||
dotnet:
|
||||
name: C# (NuGet)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-cs
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "8.0.x"
|
||||
|
||||
- name: Test
|
||||
run: dotnet test tests/ResolveSpec.Tests.csproj
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack src/ResolveSpec.csproj -c Release -p:Version="$VERSION" -o out
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
run: |
|
||||
dotnet nuget push out/*.nupkg \
|
||||
--source "${SERVER_URL}/api/packages/${OWNER}/nuget/index.json" \
|
||||
--api-key "$TOKEN" \
|
||||
--skip-duplicate
|
||||
|
||||
go:
|
||||
name: Go (Go registry)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-go
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: clients/resolvespec-go/go.mod
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
- name: Build module zip
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import os, re, zipfile
|
||||
version = "v" + os.environ["VERSION"]
|
||||
module = re.search(r"^module\s+(\S+)", open("go.mod").read(), re.M).group(1)
|
||||
prefix = f"{module}@{version}/"
|
||||
with zipfile.ZipFile("../resolvespec-go.zip", "w", zipfile.ZIP_DEFLATED) as z:
|
||||
for root, dirs, files in os.walk("."):
|
||||
dirs[:] = [d for d in dirs if d != ".git"]
|
||||
for f in files:
|
||||
path = os.path.join(root, f)
|
||||
z.write(path, prefix + os.path.relpath(path, "."))
|
||||
PY
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
run: |
|
||||
curl -f -X PUT \
|
||||
--user "${REGISTRY_USER}:${TOKEN}" \
|
||||
--upload-file ../resolvespec-go.zip \
|
||||
"${SERVER_URL}/api/packages/${OWNER}/go/upload"
|
||||
|
||||
dart:
|
||||
name: Dart (Pub)
|
||||
needs: validate
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: clients/resolvespec-dart
|
||||
env:
|
||||
VERSION: ${{ needs.validate.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
|
||||
- name: Install
|
||||
run: dart pub get
|
||||
|
||||
- name: Analyze
|
||||
run: dart analyze
|
||||
|
||||
- name: Test
|
||||
run: dart test
|
||||
|
||||
- name: Set version and registry
|
||||
run: |
|
||||
sed -i -E "s/^version: .*/version: ${VERSION}/" pubspec.yaml
|
||||
sed -i -E "s#^publish_to: .*#publish_to: ${SERVER_URL}/api/packages/${OWNER}/pub#" pubspec.yaml
|
||||
|
||||
- name: Dry run
|
||||
if: ${{ env.PUBLISH != 'true' }}
|
||||
run: dart pub publish --dry-run
|
||||
|
||||
- name: Publish
|
||||
if: ${{ env.PUBLISH == 'true' }}
|
||||
run: |
|
||||
dart pub token add "${SERVER_URL}/api/packages/${OWNER}/pub" --env-var TOKEN
|
||||
dart pub publish --force
|
||||
@@ -9,9 +9,9 @@ jobs:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.24"
|
||||
- name: Run unit tests
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
go test ./pkg/resolvespec ./pkg/restheadspec -coverprofile=coverage.out
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: coverage-report
|
||||
@@ -31,9 +31,9 @@ jobs:
|
||||
name: Race Detector
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.24"
|
||||
- name: Run unit tests with the race detector
|
||||
@@ -56,9 +56,9 @@ jobs:
|
||||
ports:
|
||||
- 5432:5432
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.24"
|
||||
- name: Create test databases
|
||||
@@ -86,16 +86,16 @@ jobs:
|
||||
go tool cover -html=coverage-restheadspec-integration.out -o coverage-restheadspec-integration.html
|
||||
|
||||
- name: Upload resolvespec integration coverage
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: resolvespec-integration-coverage-report
|
||||
path: coverage-resolvespec-integration.html
|
||||
|
||||
- name: Upload restheadspec integration coverage
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
|
||||
with:
|
||||
name: integration-coverage-restheadspec-report
|
||||
path: coverage-restheadspec-integration
|
||||
path: coverage-restheadspec-integration.html
|
||||
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial release: ResolveSpec (JSON body) and FunctionSpec client.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hein
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,6 +1,6 @@
|
||||
# resolvespec-go
|
||||
|
||||
Go client for ResolveSpec (JSON body) and FunctionSpec. Module: `github.com/bitechdev/ResolveSpec/clients/resolvespec-go`. Stdlib only.
|
||||
Go client for ResolveSpec (JSON body) and FunctionSpec. Module: `git.warky.dev/wdevs/ResolveSpec/clients/resolvespec-go`. Stdlib only.
|
||||
|
||||
## Clients
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module github.com/bitechdev/ResolveSpec/clients/resolvespec-go
|
||||
module git.warky.dev/wdevs/ResolveSpec/clients/resolvespec-go
|
||||
|
||||
go 1.22
|
||||
|
||||
Reference in New Issue
Block a user