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

Syncing main with latest beta #110

Merged
merged 57 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3db1e10
added support for CI/CD
nevilm-lt Feb 23, 2022
50a60de
added support for tags
nevilm-lt Feb 23, 2022
f312349
Merge pull request #27 from nevilm-lt/master
Shahid-LT Feb 28, 2022
8382785
added slug for variables
Shahid-LT Feb 28, 2022
023a662
Merge pull request #35 from Shahid-LT/stage
Shahid-LT Feb 28, 2022
5119a2a
Merge pull request #44 from LambdaTest/master
Shahid-LT Mar 7, 2022
085542d
updated ci/cd
nevilm-lt Mar 7, 2022
9c2e08e
Merge pull request #45 from nevilm-lt/patch-3
Shahid-LT Mar 7, 2022
dbbce58
Merge pull request #46 from LambdaTest/dev
Shahid-LT Mar 7, 2022
bf2b38b
Run test n times (#39)
palashmarantas Mar 8, 2022
a1916fb
logging timestamps and standard log format (#50)
saurabh-prakash Mar 8, 2022
ceb3d5b
updated image push action (#48)
nevilm-lt Mar 8, 2022
7c379ad
Feature/docker test (#24)
VikrantKS Mar 9, 2022
48cfb4e
upgraded dependency (#51)
saurabh-prakash Mar 9, 2022
ca136b4
use new sdk for azure blob storage
rishabh-arya95 Mar 9, 2022
501b9f8
resolve merge conflicts
rishabh-arya95 Mar 9, 2022
ff5951b
remove bundle
rishabh-arya95 Mar 9, 2022
09be7b1
Merge pull request #53 from rishabh-arya95/migrate-azure-sdk-library
rishabh-arya95 Mar 9, 2022
9afb5ab
updated README.md (#56)
nevilm-lt Mar 10, 2022
f67d6fb
proper error handling in case blob not found (#57)
rishabh-arya95 Mar 10, 2022
12d7ac6
add unit tests (#4)
sachinkumargit Mar 10, 2022
2a67532
updated ci/cd (#59)
nevilm-lt Mar 11, 2022
76c57ea
Nucleus unit tests part2 (#34)
sachinkumargit Mar 11, 2022
bacb2b7
Update main.yml (#60)
nevilm-lt Mar 14, 2022
70dbbec
added support for dispatch triggers
nevilm-lt Mar 14, 2022
0f01b74
Merge pull request #61 from nevilm-lt/fix/ci-cd
Shahid-LT Mar 14, 2022
d5579d7
added workflow_dispatch
nevilm-lt Mar 14, 2022
199b620
Merge pull request #62 from LambdaTest/update-ci-cd
nevilm-lt Mar 14, 2022
e29577d
Handle blocktests (#54)
palashmarantas Mar 14, 2022
9ccfe2c
minor fix
nevilm-lt Mar 14, 2022
9481952
Merge pull request #63 from LambdaTest/patch-ci
Shahid-LT Mar 14, 2022
0079ecc
Update main.yml
nevilm-lt Mar 14, 2022
b66d8e8
Merge pull request #64 from LambdaTest/fix/cicd
Shahid-LT Mar 14, 2022
80dfd61
Feature bitbucket (#47)
utkarsh-lambdatest Mar 14, 2022
d4bf3cd
Merge pull request #65 from LambdaTest/dev
VikrantKS Mar 15, 2022
b25f591
Init git while cloning (#67)
saurabh-prakash Mar 21, 2022
df384bb
synapse ws reconnect (#42)
VikrantKS Mar 21, 2022
79899b3
update json keys for test suite payload (#70)
palashmarantas Mar 22, 2022
393a943
added refresh token api (#69)
utkarsh-lambdatest Mar 23, 2022
829f967
Update README.md (#58) (#76)
nevilm-lt Mar 23, 2022
7fb9caa
updated readme for ambiguity (#77)
nevilm-lt Mar 23, 2022
f3cfea0
Update main.yml (#79)
saurabh-prakash Mar 23, 2022
cf6756a
Feature/synapse bitbucket (#80)
utkarsh-lambdatest Mar 24, 2022
237fdf7
Bugfix/bitbucket fork pr (#84)
utkarsh-lambdatest Mar 25, 2022
dbee93d
Removed parsing pod (#52)
saurabh-prakash Mar 25, 2022
ce48760
uncommented lint configuration (#88)
saurabh-prakash Mar 25, 2022
84c03c2
Corrected status of tasks. (#93)
saurabh-prakash Mar 28, 2022
e91cd73
Merge pull request #95 from LambdaTest/sync-dev-28-03-2022
saurabh-prakash Mar 28, 2022
d7b4976
Merge pull request #96 from LambdaTest/sync-dev-28-03-2022-part-2
saurabh-prakash Mar 28, 2022
72aa6e8
[Feature]: Support for execution logs files (#92)
nevilm-lt Mar 29, 2022
f3da61f
bugfix synapse reconnect (#101)
VikrantKS Mar 30, 2022
39e7991
Totaltests bugfix (#104)
palashmarantas Mar 30, 2022
fcfbba6
Fixed private auth in GitLab clone (#105)
saurabh-prakash Mar 30, 2022
624c8cd
Merge pull request #106 from LambdaTest/beta-sync-31-03-2022
saurabh-prakash Mar 31, 2022
b2b9c5d
Fixed private oauth in case of private bitbucket repos (#107)
saurabh-prakash Mar 31, 2022
ad96956
Merge pull request #108 from LambdaTest/beta-sync-31-03-2022-part-2
saurabh-prakash Mar 31, 2022
9f4f714
Merge branch 'main' of github.com:LambdaTest/test-at-scale into main-…
saurabh-prakash Mar 31, 2022
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
64 changes: 63 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ on:
push:
branches:
- main
- beta
- dev
tags: [ 'v*.*.*' ]


pull_request:
branches:
- main
- beta
- dev

workflow_dispatch:

env:
REGISTRY_NAME: lambdatest

jobs:
Unit_Test_Cases:
Expand Down Expand Up @@ -55,6 +64,7 @@ jobs:
run: |
go test -parallel 4 -coverpkg=./... -coverprofile=profile.cov ./...
go tool cover -func profile.cov

Go_Report_Card:
runs-on: ubuntu-latest
needs: [ Unit_Test_Cases, Performance_Test_Cases ]
Expand Down Expand Up @@ -109,3 +119,55 @@ jobs:
else
exit 0
fi

Build_To_Deploy:
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [ Test_Coverage, Go_Report_Card ]
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x

- name: Checkout
uses: actions/checkout@v2.4.0

- name: Build Cloud Runners
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/dev' }}
run: |
curl -X POST "https://api.github.com/repos/LambdaTest/test-at-scale-deployment/actions/workflows/main.yml/dispatches" -H "Authorization:Bearer ${{ secrets.GH_API_TOKEN }}" -d '{"ref":"${{env.GITHUB_REF_SLUG}}"}'

- name: Setup Docker Image Tags
run: |
if [ ${GITHUB_REF_SLUG} == "main" ] ; then
echo "NUCLEUS_TAGS=${REGISTRY_NAME}/nucleus:base" >> $GITHUB_ENV
echo "SYNAPSE_TAGS=${REGISTRY_NAME}/synapse:latest","${REGISTRY_NAME}/synapse:prod" >> $GITHUB_ENV
else
echo "NUCLEUS_TAGS=${REGISTRY_NAME}/nucleus:base-${GITHUB_REF_SLUG}" >> $GITHUB_ENV
echo "SYNAPSE_TAGS=${REGISTRY_NAME}/synapse:${GITHUB_REF_SLUG}" >> $GITHUB_ENV
fi

- name: Docker Login
uses: docker/login-action@v1.13.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
logout: true

- name: Build and push Nucleus images
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v') }}
uses: docker/build-push-action@v2.9.0
with:
context: .
tags: ${{ env.NUCLEUS_TAGS }}
file: build/nucleus/Dockerfile
push: true

- name: Build and push Synapse images
if: ${{ github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
uses: docker/build-push-action@v2.9.0
with:
context: .
tags: ${{ env.SYNAPSE_TAGS }}
file: build/synapse/Dockerfile
push: true

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,5 @@ mould.log

.env

testdata

.synapse.json
logs
136 changes: 136 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Uncomment following lines after fixing linting issues in test files

linters-settings:
depguard:
list-type: blacklist
funlen:
lines: 100
statements: 50
gci:
local-prefixes: github.com/golangci/golangci-lint
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- exhaustive
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

# don't enable:
# - asciicheck
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - revive
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd

- path: pkg/golinters/errcheck.go
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/commands/run.go
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"

run:
timeout: 2m
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio
- pkg/docs
4 changes: 2 additions & 2 deletions .sample.synapse.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"logConfig": {
"enableConsole": true,
"consoleJSONFormat": true,
"consolelevel": "debug"
},
"Lambdatest": {
"SecretKey": "SecretKeyForLambdaTest"
},
"Git": {
"Token": ""
"Token": "",
"TokenType": "Bearer"
},
"ContainerRegistry": {
"PullPolicy": "always",
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ SYNAPSE_IMAGE_NAME ?= lambdatest/synapse:latest
usage: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/:.*##\s*/##/g' | awk -F'##' '{ printf "%-25s -> %s\n", $$1, $$2 }'

build-nucleus-image: ## builds nucleus docker image
lint: ## Runs linting
golangci-lint run

build-nucleus-image: ## Builds nucleus docker image
docker build -t ${NUCLEUS_IMAGE_NAME} --file $(NUCLEUS_DOCKER_FILE) .

build-nucleus-bin: ## builds nucleus binary
build-nucleus-bin: ## Builds nucleus binary
bash build/nucleus/build.sh

build-synapse-image: ## builds synapse docker image
build-synapse-image: ## Builds synapse docker image
docker build -t ${SYNAPSE_IMAGE_NAME} --file $(SYNAPSE_DOCKER_FILE) .

build-synapse-bin: ## builds synapse binary
build-synapse-bin: ## Builds synapse binary
bash build/synapse/build.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ curl https://raw.githubusercontent.com/LambdaTest/test-at-scale/main/.sample.syn
#### Installation on Docker

##### Prerequisites
- [Docker](https://docs.docker.com/get-docker/) or [Docker-Compose](https://docs.docker.com/compose/install/) (Recommended)
- [Docker](https://docs.docker.com/get-docker/) and [Docker-Compose](https://docs.docker.com/compose/install/) (Recommended)

##### Docker Compose
- Run the docker application.
Expand Down
6 changes: 3 additions & 3 deletions build/nucleus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ WORKDIR /tmp/custom-runners
RUN npm init -y

RUN npm i --global-style --legacy-peer-deps \
@lambdatest/test-at-scale-jasmine-runner@~0.0.1 \
@lambdatest/test-at-scale-mocha-runner@~0.0.1 \
@lambdatest/test-at-scale-jest-runner@~0.0.1
@lambdatest/test-at-scale-jasmine-runner@~0.1.0 \
@lambdatest/test-at-scale-mocha-runner@~0.1.0 \
@lambdatest/test-at-scale-jest-runner@~0.1.0
RUN npm i -g nyc@^15.1.0

RUN tar -zcf /custom-runners/custom-runners.tgz node_modules
Expand Down
24 changes: 12 additions & 12 deletions cmd/nucleus/bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/LambdaTest/synapse/config"
"github.com/LambdaTest/synapse/pkg/api"
"github.com/LambdaTest/synapse/pkg/azure"
"github.com/LambdaTest/synapse/pkg/blocktestservice"
"github.com/LambdaTest/synapse/pkg/cachemanager"
"github.com/LambdaTest/synapse/pkg/command"
"github.com/LambdaTest/synapse/pkg/core"
Expand All @@ -24,14 +25,13 @@ import (
"github.com/LambdaTest/synapse/pkg/global"
"github.com/LambdaTest/synapse/pkg/lumber"
"github.com/LambdaTest/synapse/pkg/payloadmanager"
"github.com/LambdaTest/synapse/pkg/requestutils"
"github.com/LambdaTest/synapse/pkg/secret"
"github.com/LambdaTest/synapse/pkg/server"
"github.com/LambdaTest/synapse/pkg/service/coverage"
"github.com/LambdaTest/synapse/pkg/service/parser"
"github.com/LambdaTest/synapse/pkg/service/teststats"
"github.com/LambdaTest/synapse/pkg/tasconfigmanager"
"github.com/LambdaTest/synapse/pkg/task"
"github.com/LambdaTest/synapse/pkg/testblocklistservice"
"github.com/LambdaTest/synapse/pkg/testdiscoveryservice"
"github.com/LambdaTest/synapse/pkg/testexecutionservice"
"github.com/LambdaTest/synapse/pkg/zstd"
Expand Down Expand Up @@ -114,18 +114,21 @@ func run(cmd *cobra.Command, args []string) {
pm := payloadmanager.NewPayloadManger(azureClient, logger, cfg)
secretParser := secret.New(logger)
tcm := tasconfigmanager.NewTASConfigManager(logger)
gm := gitmanager.NewGitManager(logger)
dm := diffmanager.NewDiffManager(cfg, logger)
requests := requestutils.New(logger)
execManager := command.NewExecutionManager(secretParser, azureClient, logger)
tds := testdiscoveryservice.NewTestDiscoveryService(execManager, logger)
gm := gitmanager.NewGitManager(logger, execManager)
dm := diffmanager.NewDiffManager(cfg, logger)

tdResChan := make(chan core.DiscoveryResult)
tds := testdiscoveryservice.NewTestDiscoveryService(ctx, tdResChan, execManager, requests, logger)
tes := testexecutionservice.NewTestExecutionService(execManager, azureClient, ts, logger)
tbs, err := testblocklistservice.NewTestBlockListService(cfg, logger)
tbs, err := blocktestservice.NewTestBlockTestService(cfg, logger)
if err != nil {
logger.Fatalf("failed to initialize test blocklist service: %v", err)
}
router := api.NewRouter(logger, ts)
router := api.NewRouter(logger, ts, tdResChan)

t, err := task.New(ctx, cfg, logger)
t, err := task.New(ctx, requests, logger)
if err != nil {
logger.Fatalf("failed to initialize task: %v", err)
}
Expand All @@ -139,8 +142,6 @@ func run(cmd *cobra.Command, args []string) {
logger.Fatalf("failed to initialize cache manager: %v", err)
}

parserService := parser.New(tcm, logger)

coverageService, err := coverage.New(execManager, azureClient, zstd, cfg, logger)
if err != nil {
logger.Fatalf("failed to initialize coverage service: %v", err)
Expand All @@ -151,10 +152,9 @@ func run(cmd *cobra.Command, args []string) {
pl.GitManager = gm
pl.DiffManager = dm
pl.TestDiscoveryService = tds
pl.TestBlockListService = tbs
pl.BlockTestService = tbs
pl.TestExecutionService = tes
pl.ExecutionManager = execManager
pl.ParserService = parserService
pl.CoverageService = coverageService
pl.TestStats = ts
pl.Task = t
Expand Down
1 change: 0 additions & 1 deletion cmd/nucleus/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ func AttachCLIFlags(rootCmd *cobra.Command) error {
rootCmd.PersistentFlags().StringP("payloadAddress", "l", "", "Payload address")
rootCmd.PersistentFlags().BoolP("verbose", "", false, "Run in verbose mode")
rootCmd.PersistentFlags().BoolP("coverage", "", false, "Run coverage only mode")
rootCmd.PersistentFlags().BoolP("parser", "", false, "Run YML parsing only mode")
rootCmd.PersistentFlags().BoolP("discover", "", false, "Run nucleus in test discovery mode")
rootCmd.PersistentFlags().BoolP("execute", "", false, "Run nucleus in test execution mode")
rootCmd.PersistentFlags().StringP("env", "e", "prod", "Environment.")
Expand Down
Loading