feat: generate an actual client (#1) #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| # Permissions needed to push to gh-pages and create releases | |
| permissions: | |
| contents: write | |
| pages: write | |
| jobs: | |
| openapi-client-generation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Verify OpenAPI client generation | |
| run: | | |
| # Store hash of essential generated files | |
| find src -type f \( -name "*.ts" -o -name "*.json" \) -not -path "*/\.*" -exec sha256sum {} \; | sort > generated_files.hash | |
| # Generate again | |
| npm run generate | |
| # Compare hashes of essential files | |
| find src -type f \( -name "*.ts" -o -name "*.json" \) -not -path "*/\.*" -exec sha256sum {} \; | sort > new_generated_files.hash | |
| if ! diff generated_files.hash new_generated_files.hash; then | |
| echo "ERROR: Generated files differ from committed files." | |
| echo "This usually means that the OpenAPI client code needs to be regenerated." | |
| echo "Please run 'npm run generate' locally and commit the changes." | |
| echo "" | |
| echo "Differences found in the following files:" | |
| diff generated_files.hash new_generated_files.hash || true | |
| exit 1 | |
| fi | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Set up Julia | |
| uses: julia-actions/setup-julia@v2 | |
| - name: Cache Julia packages | |
| uses: julia-actions/cache@v2 | |
| - name: Clone RxInferServer | |
| run: | | |
| git clone https://github.com/lazydynamics/RxInferServer.git | |
| cd RxInferServer | |
| - name: Build RxInferServer | |
| uses: julia-actions/julia-buildpkg@v1 | |
| - name: Start RxInferServer in background and execute tests | |
| run: | | |
| cd RxInferServer | |
| make docker | |
| make dev & | |
| cd .. | |
| npm test | |
| release: | |
| needs: [openapi-client-generation, test] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "[email protected]" | |
| - name: Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm run release | |
| docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Set up Julia | |
| uses: julia-actions/setup-julia@v2 | |
| - name: Cache Julia packages | |
| uses: julia-actions/cache@v2 | |
| - name: Clone RxInferServer | |
| run: | | |
| git clone https://github.com/lazydynamics/RxInferServer.git | |
| cd RxInferServer | |
| - name: Build RxInferServer | |
| uses: julia-actions/julia-buildpkg@v1 | |
| - name: Start RxInferServer in background and build docs | |
| run: | | |
| cd RxInferServer | |
| make docker | |
| make dev & | |
| cd .. | |
| npm run docs | |
| - name: Deploy documentation | |
| if: github.ref == 'refs/heads/main' | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/build | |
| publish_branch: gh-pages |