Skip to content

[csolution rpc]: Add method to report context info #135

[csolution rpc]: Add method to report context info

[csolution rpc]: Add method to report context info #135

Workflow file for this run

name: codegen
on:
push:
branches:
- main
paths:
- '.github/workflows/codegen.yml'
- 'codegen/**'
- 'api/*.yml'
- '!**/*.md'
pull_request:
paths:
- '.github/workflows/codegen.yml'
- 'codegen/**'
- 'api/*.yml'
- '!**/*.md'
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
tests:
if: |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }}
timeout-minutes: 15
runs-on: ubuntu-latest
name: 'Test codegen'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout csolution-rpc repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
working-directory: codegen
- name: Run linter
run: npm run lint
working-directory: codegen
- name: Run tests
run: npm test
working-directory: codegen
- name: Archive test report
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: codegen-test
path: codegen/reports/junit/testreport.xml
retention-days: 1
if-no-files-found: error
- name: Archive generated interface files
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: codegen-rpc-interfaces
path: codegen/generated/*
retention-days: 1
if-no-files-found: error
release:
if: ${{ github.event_name == 'release' }}
needs: [ tests ]
timeout-minutes: 15
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Download generated files
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: codegen-rpc-interfaces
path: generated
- name: Check release version tag
run: |
version=$(grep -oP 'RPC_API_VERSION\s*=\s*"\K[^"]+' RpcInterface.h)
tag=${{ github.event.release.tag_name }}
tag="${tag#v}"
if [ "$tag" != "$version" ]; then
echo "Release version does not match the version in generated interfaces. Update csolution-openapi.yml"
exit 1
fi
working-directory: generated
- name: ZIP generated files
run: zip -r csolution-rpc.zip RpcInterface.h rpc-interface.ts
working-directory: generated
- name: TAR generated files
run: tar -czf csolution-rpc.tar.gz RpcInterface.h rpc-interface.ts
working-directory: generated
- name: Attach files to release assets
id: release_assets
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: generated/csolution-rpc.*
tag: ${{ github.ref }}
overwrite: true
file_glob: true