feat: implement CLI entrypoints and minimize docker image size #12
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: jsonpath-mapper-service | |
| on: | |
| push: | |
| branches: ["master"] | |
| paths: | |
| - "services/jsonpath-mapper-service/**" | |
| pull_request: | |
| branches: ["master"] | |
| paths: | |
| - "services/jsonpath-mapper-service/**" | |
| defaults: | |
| run: | |
| working-directory: services/jsonpath-mapper-service | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "npm" | |
| cache-dependency-path: services/jsonpath-mapper-service/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: ESLint | |
| run: npm run lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "npm" | |
| cache-dependency-path: services/jsonpath-mapper-service/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build lib | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: services/jsonpath-mapper-service/coverage/lcov.info | |
| flags: jsonpath-mapper-service | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| if: always() | |
| generate-openapi: | |
| name: Generate OpenAPI Spec | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "npm" | |
| cache-dependency-path: services/jsonpath-mapper-service/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate OpenAPI spec | |
| run: npm run generate:openapi | |
| - name: Upload OpenAPI spec | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openapi-spec-jsonpath-mapper-service | |
| path: services/jsonpath-mapper-service/jsonpath-mapper-service.openapi.json | |
| build: | |
| name: Build & Push Docker Image | |
| runs-on: ubuntu-latest | |
| needs: generate-openapi | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/jsonpath-mapper-service | |
| tags: | | |
| type=sha,prefix=sha- | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: services/jsonpath-mapper-service | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |