Skip to content

Commit

Permalink
build: ci adjustments (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-elliott authored Dec 22, 2023
1 parent cc8d947 commit 569e091
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 35 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Generate

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.21
- run: make generate
- name: Indicate generation issues
run: git diff HEAD --exit-code --color
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
format: .bin/goimports node_modules # formats the source code
.bin/goimports -w .
format: .bin/goimports-reviser node_modules # formats the source code
.bin/goimports-reviser -rm-unused -recursive .
npm exec -- prettier --write .

generate: .bin/mockgen
MOCKGEN=".bin/mockgen" ./generate-mocks.sh

help:
@cat Makefile | grep '^[^ ]*:' | grep -v '^\.bin/' | grep -v '.SILENT:' | grep -v '^node_modules:' | grep -v help | sed 's/:.*#/#/' | column -s "#" -t

test: # runs all tests
go test ./...

.bin/goimports: Makefile
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest
.bin/goimports-reviser: Makefile
GOBIN=$(shell pwd)/.bin go install github.com/incu6us/goimports-reviser/v3@latest

.bin/mockgen: Makefile
GOBIN=$(shell pwd)/.bin go install go.uber.org/mock/mockgen@latest

node_modules: package-lock.json
npm ci
Expand Down
58 changes: 28 additions & 30 deletions generate-mocks.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
#!/bin/bash

mockgen -package internal -destination internal/hash.go authelia.com/provider/oauth2 Hasher
mockgen -package internal -destination internal/storage.go authelia.com/provider/oauth2 Storage
mockgen -package internal -destination internal/transactional.go authelia.com/provider/oauth2/storage Transactional
mockgen -package internal -destination internal/oauth2_storage.go authelia.com/provider/oauth2/handler/oauth2 CoreStorage
mockgen -package internal -destination internal/oauth2_strategy.go authelia.com/provider/oauth2/handler/oauth2 CoreStrategy
mockgen -package internal -destination internal/authorize_code_storage.go authelia.com/provider/oauth2/handler/oauth2 AuthorizeCodeStorage
mockgen -package internal -destination internal/oauth2_auth_jwt_storage.go authelia.com/provider/oauth2/handler/rfc7523 RFC7523KeyStorage
mockgen -package internal -destination internal/access_token_storage.go authelia.com/provider/oauth2/handler/oauth2 AccessTokenStorage
mockgen -package internal -destination internal/refresh_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 RefreshTokenStorage
mockgen -package internal -destination internal/oauth2_client_storage.go authelia.com/provider/oauth2/handler/oauth2 ClientCredentialsGrantStorage
mockgen -package internal -destination internal/oauth2_owner_storage.go authelia.com/provider/oauth2/handler/oauth2 ResourceOwnerPasswordCredentialsGrantStorage
mockgen -package internal -destination internal/oauth2_revoke_storage.go authelia.com/provider/oauth2/handler/oauth2 TokenRevocationStorage
mockgen -package internal -destination internal/openid_id_token_storage.go authelia.com/provider/oauth2/handler/openid OpenIDConnectRequestStorage
mockgen -package internal -destination internal/access_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 AccessTokenStrategy
mockgen -package internal -destination internal/refresh_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 RefreshTokenStrategy
mockgen -package internal -destination internal/authorize_code_strategy.go authelia.com/provider/oauth2/handler/oauth2 AuthorizeCodeStrategy
mockgen -package internal -destination internal/id_token_strategy.go authelia.com/provider/oauth2/handler/openid OpenIDConnectTokenStrategy
mockgen -package internal -destination internal/pkce_storage_strategy.go authelia.com/provider/oauth2/handler/pkce PKCERequestStorage
mockgen -package internal -destination internal/authorize_handler.go authelia.com/provider/oauth2 AuthorizeEndpointHandler
mockgen -package internal -destination internal/revoke_handler.go authelia.com/provider/oauth2 RevocationHandler
mockgen -package internal -destination internal/token_handler.go authelia.com/provider/oauth2 TokenEndpointHandler
mockgen -package internal -destination internal/introspector.go authelia.com/provider/oauth2 TokenIntrospector
mockgen -package internal -destination internal/client.go authelia.com/provider/oauth2 Client
mockgen -package internal -destination internal/request.go authelia.com/provider/oauth2 Requester
mockgen -package internal -destination internal/access_request.go authelia.com/provider/oauth2 AccessRequester
mockgen -package internal -destination internal/access_response.go authelia.com/provider/oauth2 AccessResponder
mockgen -package internal -destination internal/authorize_request.go authelia.com/provider/oauth2 AuthorizeRequester
mockgen -package internal -destination internal/authorize_response.go authelia.com/provider/oauth2 AuthorizeResponder

goimports -w internal/
${MOCKGEN:-mockgen} -package internal -destination internal/hash.go authelia.com/provider/oauth2 Hasher
${MOCKGEN:-mockgen} -package internal -destination internal/storage.go authelia.com/provider/oauth2 Storage
${MOCKGEN:-mockgen} -package internal -destination internal/transactional.go authelia.com/provider/oauth2/storage Transactional
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_storage.go authelia.com/provider/oauth2/handler/oauth2 CoreStorage
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_strategy.go authelia.com/provider/oauth2/handler/oauth2 CoreStrategy
${MOCKGEN:-mockgen} -package internal -destination internal/authorize_code_storage.go authelia.com/provider/oauth2/handler/oauth2 AuthorizeCodeStorage
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_auth_jwt_storage.go authelia.com/provider/oauth2/handler/rfc7523 RFC7523KeyStorage
${MOCKGEN:-mockgen} -package internal -destination internal/access_token_storage.go authelia.com/provider/oauth2/handler/oauth2 AccessTokenStorage
${MOCKGEN:-mockgen} -package internal -destination internal/refresh_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 RefreshTokenStorage
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_client_storage.go authelia.com/provider/oauth2/handler/oauth2 ClientCredentialsGrantStorage
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_owner_storage.go authelia.com/provider/oauth2/handler/oauth2 ResourceOwnerPasswordCredentialsGrantStorage
${MOCKGEN:-mockgen} -package internal -destination internal/oauth2_revoke_storage.go authelia.com/provider/oauth2/handler/oauth2 TokenRevocationStorage
${MOCKGEN:-mockgen} -package internal -destination internal/openid_id_token_storage.go authelia.com/provider/oauth2/handler/openid OpenIDConnectRequestStorage
${MOCKGEN:-mockgen} -package internal -destination internal/access_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 AccessTokenStrategy
${MOCKGEN:-mockgen} -package internal -destination internal/refresh_token_strategy.go authelia.com/provider/oauth2/handler/oauth2 RefreshTokenStrategy
${MOCKGEN:-mockgen} -package internal -destination internal/authorize_code_strategy.go authelia.com/provider/oauth2/handler/oauth2 AuthorizeCodeStrategy
${MOCKGEN:-mockgen} -package internal -destination internal/id_token_strategy.go authelia.com/provider/oauth2/handler/openid OpenIDConnectTokenStrategy
${MOCKGEN:-mockgen} -package internal -destination internal/pkce_storage_strategy.go authelia.com/provider/oauth2/handler/pkce PKCERequestStorage
${MOCKGEN:-mockgen} -package internal -destination internal/authorize_handler.go authelia.com/provider/oauth2 AuthorizeEndpointHandler
${MOCKGEN:-mockgen} -package internal -destination internal/revoke_handler.go authelia.com/provider/oauth2 RevocationHandler
${MOCKGEN:-mockgen} -package internal -destination internal/token_handler.go authelia.com/provider/oauth2 TokenEndpointHandler
${MOCKGEN:-mockgen} -package internal -destination internal/introspector.go authelia.com/provider/oauth2 TokenIntrospector
${MOCKGEN:-mockgen} -package internal -destination internal/client.go authelia.com/provider/oauth2 Client
${MOCKGEN:-mockgen} -package internal -destination internal/request.go authelia.com/provider/oauth2 Requester
${MOCKGEN:-mockgen} -package internal -destination internal/access_request.go authelia.com/provider/oauth2 AccessRequester
${MOCKGEN:-mockgen} -package internal -destination internal/access_response.go authelia.com/provider/oauth2 AccessResponder
${MOCKGEN:-mockgen} -package internal -destination internal/authorize_request.go authelia.com/provider/oauth2 AuthorizeRequester
${MOCKGEN:-mockgen} -package internal -destination internal/authorize_response.go authelia.com/provider/oauth2 AuthorizeResponder
3 changes: 2 additions & 1 deletion handler/oauth2/flow_none_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"

"authelia.com/provider/oauth2"
"authelia.com/provider/oauth2/internal/consts"
"github.com/stretchr/testify/assert"
)

func TestNone_HandleAuthorizeEndpointRequest(t *testing.T) {
Expand Down

0 comments on commit 569e091

Please sign in to comment.