Files
Nicholas Wiersma d932d50232 chore: lint code with golangci-lint (#1828)
* feat: add golangci-lint linting

* chore: fix linter issues

* feat: add linting into the workflow

* docs: update lint docs

* fix: cr suggestions

* fix: remove old formatting and vetting scripts

* fix: add docker make target

* fix: action go caching

* fix: depreciated actions checkout version

* fix: cr suggestion

* fix: cr suggestions

---------

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2023-02-24 20:39:17 -08:00

134 lines
2.1 KiB
PowerShell

[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[switch]$build,
[Parameter(Mandatory=$false)]
[switch]$run,
[Parameter(Mandatory=$false)]
[switch]$docs,
[Parameter(Mandatory=$false)]
[Alias("setup-dev-env")]
[switch]$setup_dev_env,
[Parameter(Mandatory=$false)]
[switch]$verify,
[Parameter(Mandatory=$false)]
[switch]$test,
[Parameter(Mandatory=$false)]
[Alias("test-unit")]
[switch]$test_unit,
[Parameter(Mandatory=$false)]
[Alias("test-e2e")]
[switch]$test_e2e,
[Parameter(Mandatory=$false)]
[switch]$docker,
[Parameter(Mandatory=$false)]
[Alias("proxy-docker")]
[switch]$proxy_docker,
[Parameter(Mandatory=$false)]
[switch]$bench,
[Parameter(Mandatory=$false)]
[switch]$alldeps,
[Parameter(Mandatory=$false)]
[switch]$dev,
[Parameter(Mandatory=$false)]
[switch]$down
)
function execScript($name) {
$scriptsDir = "$(Join-Path scripts ps)"
& "$(Join-Path $scriptsDir $name)"
}
if ($setup_dev_env.IsPresent) {
& docker-compose -p athensdev up -d mongo
}
if ($build.IsPresent) {
try {
Push-Location $(Join-Path cmd proxy)
& go build
}
finally {
Pop-Location
}
finally {
Pop-Location
}
}
if ($run.IsPresent) {
Set-Location $(Join-Path cmd proxy)
}
if ($docs.IsPresent) {
Set-Location docs
& hugo
}
if ($verify.IsPresent) {
execScript "check_deps.ps1"
}
if ($alldeps.IsPresent) {
& docker-compose -p athensdev up -d mongo
& docker-compose -p athensdev up -d minio
& docker-compose -p athensdev up -d jaeger
Write-Host "sleeping for a bit to wait for the DB to come up"
Start-Sleep 5
}
if ($dev.IsPresent) {
& docker-compose -p athensdev up -d mongo
}
if ($test.IsPresent) {
try {
Push-Location $(Join-Path cmd proxy)
}
finally {
Pop-Location
}
finally {
Pop-Location
}
}
if ($test_unit.IsPresent) {
execScript "test_unit.ps1"
}
if ($test_e2e.IsPresent) {
execScript "test_e2e.ps1"
}
if ($docker.IsPresent) {
& docker build -t gomods/athens -f cmd/proxy/Dockerfile .
}
if ($proxy_docker.IsPresent) {
& docker build -t gomods/athens -f cmd/proxy/Dockerfile .
}
if ($bench.IsPresent) {
execScript "benchmark.ps1"
}
if ($down.IsPresent) {
& docker-compose -p athensdev down -v
}