-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from azuki774/add-workflows-test
add workflows
- Loading branch information
Showing
8 changed files
with
165 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Build Docker Image | ||
run: make build |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
ghcr.io/azuki774/go-authenticator | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=semver,pattern=latest | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GH_ACCESS_TOKEN }} | ||
|
||
- name: Docker Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64 #,linux/arm64 | ||
file: ./build/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.22.5 | ||
- uses: dominikh/[email protected] | ||
with: | ||
version: "2024.1" | ||
install-go: false | ||
- name: Test | ||
run: make test | ||
|
||
scenario-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.22.5 | ||
|
||
- name: Build | ||
run: make bin | ||
|
||
- name: Running Server | ||
run: | | ||
nohup build/bin/go-authenticator serve &> server.log & | ||
sleep 5s | ||
env: | ||
HMAC_SECRET: mokomoko | ||
|
||
- name: Scenario 1 (ping) | ||
run: | | ||
curl -i ${url} | grep "${want}" | ||
env: | ||
url: "http://localhost:8888/" | ||
want: "HTTP/1.1 200 OK" | ||
|
||
- name: Scenario 2 (/basic_login no password) | ||
run: | | ||
curl -i ${url} | grep "${want}" | ||
env: | ||
url: "http://localhost:8888/basic_login" | ||
want: "HTTP/1.1 401 Unauthorized" | ||
|
||
- name: Scenario 3 (/basic_login OK, save cookie) | ||
run: | | ||
curl -c cookie.txt -u user:pass -i ${url} | grep "${want}" | ||
env: | ||
url: "http://localhost:8888/basic_login" | ||
want: "HTTP/1.1 200 OK" | ||
|
||
- name: Scenario 4 (/auth_jwt_request NG) | ||
run: | | ||
curl -i ${url} | grep "${want}" | ||
env: | ||
url: "http://localhost:8888/auth_jwt_request" | ||
want: "HTTP/1.1 401 Unauthorized" | ||
|
||
- name: Scenario 5 (/auth_jwt_request OK, use cookie) | ||
run: | | ||
curl -b cookie.txt -i ${url} | grep "${want}" | ||
env: | ||
url: "http://localhost:8888/auth_jwt_request" | ||
want: "HTTP/1.1 200 OK" | ||
|
||
- name: Show Server log | ||
run: cat server.log | ||
if: ${{ ! cancelled() }} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
conf-version = 1 | ||
|
||
# For CI Sample | ||
isser_name = "ci" # your isser name | ||
isser_name = "test" # your isser name | ||
|
||
# .htpasswd format | ||
basicauth = ["user:$2a$10$etIpH1oxl4Ky5koV2AzyYe42caqi/tvtme/UTwxA7lHlB2loLDOte"] # for Test -- user:pass | ||
|
||
server_port = 8888 # proxy server listen port | ||
token_lifetime = 60 # sec | ||
token_lifetime = 300 # sec |
This file contains 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
This file contains 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