Skip to content

Commit

Permalink
Merge pull request #524 from devopsarr/feature/rust
Browse files Browse the repository at this point in the history
feat: add rust sdks
  • Loading branch information
Fuochi authored Feb 9, 2025
2 parents 1367468 + 8354c16 commit 479902e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
lang:
- go
- py
- rs
app:
- sonarr
- radarr
Expand Down Expand Up @@ -101,9 +102,13 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Set up Rust
if: ${{ matrix.lang == 'rs' }}
uses: dtolnay/[email protected]

- name: Git Version
run: |
tag=$(git describe --tags --abbrev=0) &&\
tag=$(git describe --tags --abbrev=0 || echo 'v0.0.1') &&\
echo "version=${tag:1}" >> $GITHUB_OUTPUT
id: version
working-directory: .generated-code/${{ matrix.app }}-${{ matrix.lang }}
Expand Down Expand Up @@ -147,4 +152,4 @@ jobs:
run: gh pr merge feature/code-generation --merge
working-directory: .generated-code/${{ matrix.app }}-${{ matrix.lang }}
env:
GITHUB_TOKEN: ${{ steps.DevOpsArrBOT.outputs.token }}
GITHUB_TOKEN: ${{ steps.DevOpsArrBOT.outputs.token }}
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ post-py:
sed -i 's/\(.*${VERSION}.*\)/\1 # x-release-please-version/' ${BASE_PATH}/$$file ; \
done

post-rs:
rm ${BASE_PATH}/.openapi-generator-ignore
rm -rf ${BASE_PATH}/.openapi-generator/
rm -rf ${BASE_PATH}/${APP}
sed -i 's/\(.*${VERSION}.*\)/\1 # x-release-please-version/' ${BASE_PATH}/Cargo.toml
sed -i 's/\(.*${VERSION}.*\)/\1 \/\/ x-release-please-version/' ${BASE_PATH}/src/apis/configuration.rs
mkdir -p ${BASE_PATH}/.github/workflows
cp templates/${SDK}/rust.yml ${BASE_PATH}/.github/workflows/rust.yml

git-push:
cd ${BASE_PATH} && \
git checkout -b feature/code-generation && \
Expand All @@ -80,3 +89,6 @@ ignore-go:

ignore-py:
cp templates/${SDK}/.openapi-generator-ignore ${BASE_PATH}/.openapi-generator-ignore

ignore-rs:
cp templates/${SDK}/.openapi-generator-ignore ${BASE_PATH}/.openapi-generator-ignore
6 changes: 6 additions & 0 deletions templates/rs/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore unused files
git_push.sh
.travis.yml

# add tests in a second moment
test/*
12 changes: 12 additions & 0 deletions templates/rs/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: CD

on:
push:
branches:
- main
workflow_dispatch:

jobs:
cd:
uses: devopsarr/shared-workflows/.github/workflows/rust_release.yml@main
secrets: inherit
12 changes: 12 additions & 0 deletions templates/rs/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
generatorName: rust
packageVersion: 0.0.1
httpUserAgent: Servarr-rs/v0.0.1
packageName: servarr
gitUserId: devopsarr
gitRepoId: servarr-rs
inputSpec: /local/swaggers/servarr.json
outputDir: /local/.generated-code/servarr-rs
enumClassPrefix: true
disallowAdditionalPropertiesIfNotPresent: false
templateDir: /local/templates/rs
structPrefix: false

0 comments on commit 479902e

Please sign in to comment.