This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
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.
- Loading branch information
Showing
10 changed files
with
142 additions
and
15 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,25 @@ | ||
name: verfiy rocket showcase | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '^1.21' | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: just@1,hurl@4 | ||
- run: just verify-gin |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM golang:1.19 | ||
|
||
# Set destination for COPY | ||
WORKDIR /app | ||
|
||
# Download Go modules | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy the source code. Note the slash at the end, as explained in | ||
# https://docs.docker.com/reference/dockerfile/#copy | ||
COPY *.go ./ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /docker-gs-ping | ||
|
||
# Optional: | ||
# To bind to a TCP port, runtime parameters must be supplied to the docker command. | ||
# But we can document in the Dockerfile what ports | ||
# the application is going to listen on by default. | ||
# https://docs.docker.com/reference/dockerfile/#expose | ||
EXPOSE 8002 | ||
|
||
# Run | ||
CMD ["/docker-gs-ping"] |
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,2 @@ | ||
target=http://localhost:8002 | ||
token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjEyMDkxMDkyOTAifQ.eyJhdWQiOlsibG9jYWwubXlfZG9tYWluLmNvbSJdLCJhenAiOiJkMTlYcDhEWEkxQVE4ZUNjeDdweHM5bkZiUTRUMHUwdCIsImVtYWlsIjoiam9obi5kb2VAb3B0cmF2aXMuY29tIiwiZXhwIjozMjUwMzY3NjQwMCwiaWF0IjowLCJpc3MiOiJodHRwczovL2F1dGgubXlfZG9tYWluLmNvbS8iLCJteV9vdGhlcl9zcGVjaWFsX2NsYWltIjoiaGVsbG8gd29ybGQiLCJuYW1lIjoiSm9obiIsInN1YiI6IjcwZTQ5M2Q5LTg0ZDAtNDliMS05YjYzLWJkNTVmOTVhOTI3ZSJ9.NQQFnHJlL7xiKP-6tk3gYrKpYPW8eVga_u5x6t3-l8U |
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,3 @@ | ||
# wait for healthy | ||
GET {{target}}/api/healthz | ||
HTTP 200 |
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,9 @@ | ||
services: | ||
service: | ||
image: hurl-gin:latest | ||
environment: | ||
- 'PORT=8002' | ||
- 'AUTH_HS256_SECRET=CTRKew35ltwdWhGv9WF10lJ06oYBZKzACYhANx7QXPZpvBvCNZbq161xHg2rKhcp' | ||
- 'AUTH_JWT_AUD=local.my_domain.com' | ||
ports: | ||
- '8002:8002' |
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,6 +1,6 @@ | ||
module hurl-gin | ||
|
||
go 1.22.1 | ||
go 1.21 | ||
|
||
require github.com/gin-gonic/gin v1.10.0 | ||
|
||
|
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,12 +1,61 @@ | ||
|
||
image_name := "hurl-gin:latest" | ||
hurl_opts := "--variables-file api_tests/hurl.env.test --test" | ||
|
||
run: | ||
go run main.go | ||
|
||
test: | ||
go test . | ||
|
||
verify: test (up "-d") api-test lint | ||
docker-compose down | ||
|
||
install-dep: | ||
go get -u github.com/gin-gonic/gin | ||
|
||
up c="": build | ||
docker-compose down | ||
docker-compose up {{c}} | ||
|
||
# Watch the source files and run `just verify` when source changes | ||
watch: | ||
cargo watch -- just verify | ||
|
||
# Run the static code analysis | ||
lint: | ||
golangci-lint run | ||
|
||
# Build docker image for testing | ||
build: | ||
docker build -t {{image_name}} . | ||
|
||
wait-for-api: | ||
hurl api_tests/implemented/healthz.hurl --retry 60 {{hurl_opts}} | ||
|
||
pre-api-test: | ||
hurl api/pre_test/*.hurl {{hurl_opts}} | ||
|
||
# run acceptance tests against the running test stack | ||
api-test *args: wait-for-api | ||
hurl api_tests/implemented/*.hurl {{hurl_opts}} {{args}} | ||
|
||
# run all acceptance tests against the running test stack, including for non-implemented api | ||
api-test-not-implemented *args: wait-for-api | ||
hurl api_tests/not_implemented/*.hurl {{hurl_opts}} {{args}} | ||
|
||
# Install cargo dev-tools used by the `verify` recipe (requires rustup to be already installed) | ||
install-dev-tools: | ||
just install-linter | ||
|
||
install-linter: | ||
brew install golangci-lint | ||
brew upgrade golangci-lint | ||
|
||
install-hurl: | ||
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl_4.1.0_amd64.deb | ||
udo apt update && sudo apt install ./hurl_4.1.0_amd64.deb | ||
rm hurl_4.1.0_amd64.deb | ||
|
||
|
||
@replace-token: | ||
cd token_creation && just replace |
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