Skip to content

Commit

Permalink
Merge branch 'release/0.3.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimnz committed Aug 3, 2022
2 parents e4328e0 + 0bc2a07 commit 0e1e526
Show file tree
Hide file tree
Showing 492 changed files with 60,809 additions and 33,647 deletions.
130 changes: 77 additions & 53 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,99 @@
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build:
working_directory: ~/repo
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: circleci/golang:1.17.5
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
#========================================================================================================[ COMMANDS ]
commands:

# A reusable command with a boolean parameter to specify if we want to run change detection or not.
build_and_test:

parameters:
no_change_detection:
description: "If true then just builds and runs tests, otherwise detects for database changes."
type: boolean
default: false

steps:
- checkout

- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- go-mod-v5-cimg-go-1.17-{{ checksum "go.sum" }}

- run:
name: Install Dependencies
command: make deps
name: Install go modules into the module cache.
command: make deps:modules

- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
key: go-mod-v5-cimg-go-1.17-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml -- ./... -race
environment:
DEFRA_BADGER_MEMORY: true
DEFRA_BADGER_FILE: true
DEFRA_MAP: true

- when:
condition: << parameters.no_change_detection >>
steps:
- run:
name: Run tests
command: |
make test:verbose
environment:
DEFRA_BADGER_MEMORY: true
DEFRA_BADGER_FILE: true
DEFRA_MAP: true

- when:
condition:
not: << parameters.no_change_detection >>
steps:
- run:
name: Run tests with change detection
command: |
make test:changes
environment:
DEFRA_DETECT_DATABASE_CHANGES: true

- store_test_results:
path: /tmp/test-reports
path: "/tmp/defradb-dev"


#============================================================================================================[ JOBS ]
# Define jobs to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:

# Job builds and runs all the test.
build:

working_directory: ~/repo

docker:
# https://circleci.com/developer/images/image/cimg/go
- image: cimg/go:1.17

steps:
- build_and_test:
no_change_detection: true

# Job detects if we have a database change.
change_detection:

working_directory: ~/repo
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor

docker:
- image: circleci/golang:1.17.5
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
# https://circleci.com/developer/images/image/cimg/go
- image: cimg/go:1.17

steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: make deps
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: Run tests
command: |
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml -- ./... -p 1
environment:
DEFRA_DETECT_DATABASE_CHANGES: true
- store_test_results:
path: /tmp/test-reports
- build_and_test:
no_change_detection: false


#=======================================================================================================[ WORKFLOWS ]
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-test: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.

build-test:

jobs:
- build
- change_detection
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# All files are checked into the repo with LF
* text=auto

# These files are checked out using CRLF locally
*.bat eol=crlf
18 changes: 3 additions & 15 deletions codecov.yml → .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Source Network's codecov configuration file.

github_checks:
annotations: true
annotations: true

codecov:
require_ci_to_pass: yes
Expand Down Expand Up @@ -31,23 +31,11 @@ coverage:

changes: false


comment:
layout: "reach, diff, files"
behavior: default # update if exists else create new
require_changes: true

ignore:
- "docs"
- ".circleci"
- ".github"
- "build"
- "**/*.graphql"
- "**/*.md"
- "**/*.txt"
- "licenses"
- ".gitignore"
- ".golangci.sourceinc.yaml"
- "Makefile"
# - "**/*_test.go"
# - "db/tests"
- "tests"
- "**/*_test.go"
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Relevant issue(s)

Resolves #

## Description

(*replace*) Include a summary of the changes. List the issue(s) it solves in the section above, and
create one if none exists. Include relevant motivation and context. Detail new dependencies required for this change.

## Tasks

- [ ] I made sure the code is well commented, particularly hard-to-understand areas.
- [ ] I made sure the repository-held documentation is changed accordingly.
- [ ] I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in [tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [ ] I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

## How has this been tested?

(*replace*) Describe the tests performed to verify the changes. Provide instructions to reproduce them.

Specify the platform(s) on which this was tested:
- *(modify the list accordingly*)
- Arch Linux
- Debian Linux
- MacOS
- Windows
11 changes: 6 additions & 5 deletions .github/workflows/code-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17.5'
go-version: '1.17'
check-latest: true

- name: Generate full test coverage report using go-acc
run: make test:coverage-full
run: make test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage-full.txt
files: ./coverage.txt
flags: defra-tests
name: codecov-umbrella
verbose: true
Expand Down
Loading

0 comments on commit 0e1e526

Please sign in to comment.