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

fix: improve cache and update cimg/go images #2388

Merged
merged 12 commits into from
Mar 7, 2021
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
99 changes: 32 additions & 67 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
version: 2.1

orbs:
goreleaser: ory/goreleaser@0.1.20
goreleaser: ory/goreleaser@0.1.28
slack: circleci/slack@3.4.2
sdk: ory/sdk@0.1.38
changelog: ory/changelog@0.1.4
nancy: ory/nancy@0.0.13
docs: ory/docs@0.0.8
golangci: ory/golangci@0.0.9
sdk: ory/sdk@0.1.40
changelog: ory/changelog@0.1.7
nancy: ory/nancy@0.0.14
docs: ory/docs@0.0.10
golangci: ory/golangci@0.0.18
go: circleci/go@1.5.0
prettier: ory/prettier@0.0.11

jobs:
# test-legacy-migrations:
Expand All @@ -25,7 +27,7 @@ jobs:

test:
docker:
- image: cimg/go:1.16
- image: cimg/go:1.16-node
environment:
- TEST_DATABASE_POSTGRESQL=postgres://test:test@localhost:5432/postgres?sslmode=disable
- TEST_DATABASE_MYSQL=mysql://root:test@(localhost:3306)/mysql?multiStatements=true&parseTime=true
Expand All @@ -38,26 +40,29 @@ jobs:
- image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=test
- image: cockroachdb/cockroach:v2.1.6
command: start --insecure
- image: cockroachdb/cockroach:v20.2.5
command: start-single-node --insecure
steps:
- checkout
- setup_remote_docker
- restore_cache:
keys:
- hydra-v1-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
- run: go mod download
- prettier/install
- prettier/check
- prettier/install:
dir: docs
- prettier/check:
dir: docs
- goreleaser/install
- goreleaser/check
- golangci/install
- golangci/lint
- go/load-cache
- go/mod-download
- go/save-cache
- run: make .bin/go-acc
- save_cache:
key: hydra-v1-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
paths:
- "/go/pkg/mod"
- ".bin"
- run: .bin/go-acc -o coverage.txt ./... -- -failfast -timeout=20m -tags sqlite
# Running race conditions requires parallel tests, otherwise it's worthless (which is the case)
# - run: go test -race -short $(go list ./... | grep -v cmd)
- run: test -z "$CIRCLE_PR_NUMBER" && goveralls -service=circle-ci -coverprofile=coverage.txt -repotoken=$COVERALLS_REPO_TOKEN || echo "forks are not allowed to push to coveralls"
- run: make docker

test-e2e:
parameters:
Expand All @@ -82,58 +87,28 @@ jobs:
- MYSQL_ROOT_PASSWORD=test
steps:
- checkout
# core node_modules cache
- restore_cache:
keys:
- v1-deps-{{ checksum "package-lock.json" }}
- v1-deps
- run: npm ci
- save_cache:
key: v1-deps-{{ checksum "package-lock.json" }}
# cache NPM modules and the folder with the Cypress binary
paths:
- ~/.npm
- ~/.cache

# oauth2_client node_modules cache
- restore_cache:
keys:
- v1-deps-oauth2-client-{{ checksum "test/e2e/oauth2-client/package-lock.json" }}
- v1-deps
- v2-deps-{{ checksum "package-lock.json" }}-{{ checksum "test/e2e/oauth2-client/package-lock.json" }}
- run: npm ci
- run: cd test/e2e/oauth2-client; npm ci
- save_cache:
key: v1-deps-oauth2-client-{{ checksum "test/e2e/oauth2-client/package-lock.json" }}
key: v2-deps-{{ checksum "package-lock.json" }}-{{ checksum "test/e2e/oauth2-client/package-lock.json" }}
# cache NPM modules and the folder with the Cypress binary
paths:
- ~/.npm
- ~/.cache
- /test/e2e/oauth2-client/node_modules
- test/e2e/oauth2-client/node_modules
- node_modules

# go modules cache
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- run: go install .
- save_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- go/load-cache
- go/mod-download
- go/save-cache

- run: ./test/e2e/circle-ci.bash << parameters.flavor >>
- run: ./test/e2e/circle-ci.bash << parameters.flavor >>-jwt

validate:
docker:
- image: cimg/go:1.16
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- golangci/lint
- docs/check-format
- run: |
bash <(curl -s https://raw.githubusercontent.com/ory/ci/master/src/scripts/install/prettier.sh)
npm run format:check

workflows:
bdt:
jobs:
Expand Down Expand Up @@ -163,10 +138,6 @@ workflows:
# only: /.*/
# END - Test legacy migrations

- validate:
filters:
tags:
only: /.*/
- nancy/test:
filters:
tags:
Expand Down Expand Up @@ -263,15 +234,9 @@ workflows:
branches:
only: master
## goreleaser
-
goreleaser/test:
filters:
tags:
only: /.*/
-
goreleaser/release:
requires:
- goreleaser/test
- nancy/test
- test
- test-e2e-postgres
Expand Down
13 changes: 4 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
before:
hooks:
- go mod download
- git checkout -- go.sum
- make pack

builds:
Expand Down Expand Up @@ -196,20 +197,16 @@ checksum:

dockers:
- dockerfile: .docker/Dockerfile-sqlite
builds:
ids:
- hydra-sqlite-linux-libmusl
binaries:
- hydra
image_templates:
- "oryd/hydra:v{{ .Major }}-sqlite"
- "oryd/hydra:v{{ .Major }}.{{ .Minor }}-sqlite"
- "oryd/hydra:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-sqlite"
- "oryd/hydra:{{ .Tag }}-sqlite"
- "oryd/hydra:latest-sqlite"
- dockerfile: .docker/Dockerfile-scratch
builds:
- hydra
binaries:
ids:
- hydra
image_templates:
- "oryd/hydra:v{{ .Major }}"
Expand All @@ -218,9 +215,7 @@ dockers:
- "oryd/hydra:{{ .Tag }}"
- "oryd/hydra:latest"
- dockerfile: .docker/Dockerfile-alpine
builds:
- hydra
binaries:
ids:
- hydra
image_templates:
- "oryd/hydra:v{{ .Major }}-alpine"
Expand Down
2 changes: 1 addition & 1 deletion consent/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestCreateCsrfSession(t *testing.T) {
"csrf_default": {
httpOnly: true,
secure: true,
sameSite: http.SameSiteDefaultMode,
sameSite: 0, // see https://golang.org/doc/go1.16#net/http
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/ory/analytics-go/v4 v4.0.1
github.com/ory/cli v0.0.35
github.com/ory/fosite v0.36.0
github.com/ory/go-acc v0.2.5
github.com/ory/go-acc v0.2.6
github.com/ory/graceful v0.1.1
github.com/ory/herodot v0.9.1
github.com/ory/x v0.0.170
Expand All @@ -54,6 +54,7 @@ require (
github.com/sawadashota/encrypta v0.0.2
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 // indirect
github.com/stretchr/testify v1.6.1
github.com/tidwall/gjson v1.6.7
github.com/toqueteos/webbrowser v1.2.0
Expand Down
Loading