Skip to content

Commit

Permalink
Added goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
shahariaazam committed Sep 1, 2024
1 parent a6401b8 commit 186ea62
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test OAuth Mock Server Action
on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup OAuth Mock Server
uses: ./
with:
port: 8080
client_id: test-client
client_secret: test-secret
- name: Test OAuth Mock Server
run: |
curl -I http://localhost:8080/authorize?client_id=test-client&redirect_uri=http://localhost:8081/callback&response_type=code&scope=openid%20profile%20email&state=state123
- name: Run Other Tests
run: |
# Add your other test steps here
# The OAuth mock server will be running in the background
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
default: 'test-secret'
runs:
using: 'docker'
image: 'Dockerfile'
image: 'docker://ghcr.io/shaharia-lab/oauth-mock-server:0.0.1'
env:
PORT: ${{ inputs.port }}
CLIENT_ID: ${{ inputs.client_id }}
Expand Down
20 changes: 6 additions & 14 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#!/bin/sh
set -e

# Start the OAuth mock server in the background
/oauth-mock-server &

# Store the PID of the server
SERVER_PID=$!

# Function to check if the server is up
check_server() {
curl -s -o /dev/null -w "%{http_code}" http://localhost:${PORT:-8080}/authorize
}

# Wait for the server to be ready
echo "Starting OAuth mock server..."
/oauth-mock-server &
SERVER_PID=$!

echo "Waiting for OAuth mock server to be ready..."
for i in $(seq 1 30); do
if [ "$(check_server)" = "200" ]; then
Expand All @@ -27,11 +25,5 @@ if [ "$i" = "30" ]; then
exit 1
fi

# Keep the action running
tail -f /dev/null &

# Wait for any process to exit
wait -n

# Exit with status of process that exited first
exit $?
# Keep the action running by tailing the server process
tail --pid=$SERVER_PID -f /dev/null

0 comments on commit 186ea62

Please sign in to comment.