Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First commit #19

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,25 @@ updates:
directory: "/"
schedule:
interval: "daily"
groups:
angular:
applies-to: version-updates
patterns:
- "tar"
update-types:
- "minor"
- "patch"

# /packages ディレクトリ内の npm パッケージの依存関係をチェック
- package-ecosystem: "npm"
directory: "/packages/nextjs"
schedule:
interval: "daily"
groups:
angular:
applies-to: version-updates
patterns:
- "tar"
update-types:
- "minor"
- "patch"
70 changes: 70 additions & 0 deletions .github/workflows/nextjs-package-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test Scratch Auth Next.js Package

on:
push:
paths:
- "packages/nextjs/**"
pull_request:
paths:
- "packages/nextjs/**"

jobs:
test:
runs-on: ubuntu-latest

services:
scratch-auth:
image: scratch-auth/scratch-auth:latest
ports:
- 4000:4000
options: >-
--env SCRATCH_AUTH_SECRET_KEY=${{ secrets.SCRATCH_AUTH_SECRET_KEY }}
# 環境変数をsecretsに設定しておき、GitHub Actionsから参照します。

env:
SCRATCH_AUTH_SECRET_KEY: ${{ secrets.SCRATCH_AUTH_SECRET_KEY }}
NEXT_PUBLIC_REDIRECT_URL: "http://localhost:3000/api/auth"

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
working-directory: packages/nextjs
run: npm install

- name: Run build
working-directory: packages/nextjs
run: npm run build

- name: Set environment variables for Scratch Auth
run: echo "SCRATCH_AUTH_SECRET_KEY=$SCRATCH_AUTH_SECRET_KEY" >> $GITHUB_ENV

- name: Start the Next.js application
working-directory: packages/nextjs
run: npm run dev &

- name: Wait for server to be ready
run: npx wait-on http://localhost:3000

- name: Run authentication test
run: |
curl -X POST http://localhost:3000/api/auth -d "privateCode=test"
echo "Testing authentication successful"

- name: Stop services
run: |
kill $(lsof -t -i:3000)
if: always()

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: nextjs-scratch-auth-test-results
path: packages/nextjs/test-results
2 changes: 2 additions & 0 deletions packages/nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/node_modules
package-lock.json
# Ignore test results
test-results/