diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000..fe77c03 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,73 @@ +name: Build and Test Examples + +on: + merge_group: + workflow_dispatch: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + example-fastify-web: + name: Web App + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - name: Setup Node.js with npm caching + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 22 + package-manager-cache: false + + - name: Update npm + run: npm install -g npm@11.10.0 + + - name: Install dependencies + run: npm install + + # The example imports @auth0/auth0-fastify from its built dist, so the + # SDK must be built before the example can build. + - name: Build auth0-fastify + run: npm run build -w @auth0/auth0-fastify + + - name: Build example-fastify-web + run: npm run build -w example-fastify-web + + example-fastify-api: + name: API + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - name: Setup Node.js with npm caching + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 22 + package-manager-cache: false + + - name: Update npm + run: npm install -g npm@11.10.0 + + - name: Install dependencies + run: npm install + + # The example imports @auth0/auth0-fastify-api from its built dist, so the + # SDK must be built before the example can build. + - name: Build auth0-fastify-api + run: npm run build -w @auth0/auth0-fastify-api + + - name: Build example-fastify-api + run: npm run build -w example-fastify-api diff --git a/examples/example-fastify-api/package.json b/examples/example-fastify-api/package.json index c2bb601..9d413c9 100644 --- a/examples/example-fastify-api/package.json +++ b/examples/example-fastify-api/package.json @@ -4,7 +4,8 @@ "description": "", "type": "module", "scripts": { - "start": "tsx src/index.ts --project tsconfig.json" + "start": "tsx src/index.ts --project tsconfig.json", + "build": "tsc --project tsconfig.json" }, "devDependencies": { "ts-node": "^10.9.2",