|
|
|
@ -24,15 +24,6 @@ local setupValidationDeps = function(job) job { |
|
|
|
|
smoke_test: '${binary} --version', |
|
|
|
|
tar_args: 'xvf', |
|
|
|
|
}), |
|
|
|
|
step.new('install jsonnetfmt', './lib/actions/install-binary') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.with({ |
|
|
|
|
binary: 'jsonnetfmt', |
|
|
|
|
version: '0.18.0', |
|
|
|
|
download_url: 'https://github.com/google/go-jsonnet/releases/download/v${version}/go-jsonnet_${version}_Linux_x86_64.tar.gz', |
|
|
|
|
tarball_binary_path: '${binary}', |
|
|
|
|
smoke_test: '${binary} --version', |
|
|
|
|
}), |
|
|
|
|
] + job.steps, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -44,45 +35,77 @@ local validationJob = _validationJob(false); |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(common.makeTarget(target)), |
|
|
|
|
|
|
|
|
|
test: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
validationMakeStep('test', 'test'), |
|
|
|
|
]) |
|
|
|
|
), |
|
|
|
|
// Test jobs |
|
|
|
|
collectPackages: job.new() |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
step.new('gather packages') |
|
|
|
|
+ step.withId('gather-tests') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
echo "packages=$(find . -path '*_test.go' -printf '%h\n' \ |
|
|
|
|
| grep -e "pkg/push" -e "integration" -e "operator" -e "lambda-promtail" -e "helm" -v \ |
|
|
|
|
| cut -d / -f 2,3 \ |
|
|
|
|
| uniq \ |
|
|
|
|
| sort \ |
|
|
|
|
| jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT} |
|
|
|
|
|||), |
|
|
|
|
]) |
|
|
|
|
+ job.withOutputs({ |
|
|
|
|
packages: '${{ steps.gather-tests.outputs.packages }}', |
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
integration: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
validationMakeStep('integration', 'test-integration'), |
|
|
|
|
]) |
|
|
|
|
), |
|
|
|
|
integration: validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
validationMakeStep('integration', 'test-integration'), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
lint: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps( |
|
|
|
|
[ |
|
|
|
|
validationMakeStep('lint', 'lint'), |
|
|
|
|
validationMakeStep('lint jsonnet', 'lint-jsonnet'), |
|
|
|
|
validationMakeStep('lint scripts', 'lint-scripts'), |
|
|
|
|
step.new('check format') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
git fetch origin |
|
|
|
|
make check-format |
|
|
|
|
|||), |
|
|
|
|
] + [ |
|
|
|
|
step.new('golangci-lint', 'golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.with({ |
|
|
|
|
version: '${{ inputs.golang_ci_lint_version }}', |
|
|
|
|
'only-new-issues': true, |
|
|
|
|
}), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
), |
|
|
|
|
testPackages: validationJob |
|
|
|
|
+ job.withNeeds(['collectPackages']) |
|
|
|
|
+ job.withStrategy({ |
|
|
|
|
matrix: { |
|
|
|
|
package: '${{fromJson(needs.collectPackages.outputs.packages)}}', |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
step.new('test ${{ matrix.package }}') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./${{ matrix.package }}/... |
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
check: setupValidationDeps( |
|
|
|
|
|
|
|
|
|
testLambdaPromtail: validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
step.new('test push package') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withWorkingDirectory('tools/lambda-promtail') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./... |
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
testPushPackage: validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
step.new('test push package') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withWorkingDirectory('pkg/push') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
gotestsum -- -covermode=atomic -coverprofile=coverage.txt -p=4 ./... |
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
// Check / lint jobs |
|
|
|
|
checkFiles: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
validationMakeStep('check generated files', 'check-generated-files'), |
|
|
|
@ -115,4 +138,94 @@ local validationJob = _validationJob(false); |
|
|
|
|
], |
|
|
|
|
} |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
faillint: |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
common.fixDubiousOwnership, |
|
|
|
|
step.new('faillint') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
faillint -paths "sync/atomic=go.uber.org/atomic" ./... |
|
|
|
|
|
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
golangciLint: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps( |
|
|
|
|
[ |
|
|
|
|
step.new('golangci-lint', 'golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.with({ |
|
|
|
|
version: '${{ inputs.golang_ci_lint_version }}', |
|
|
|
|
'only-new-issues': true, |
|
|
|
|
}), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
lintFiles: setupValidationDeps( |
|
|
|
|
validationJob |
|
|
|
|
+ job.withSteps( |
|
|
|
|
[ |
|
|
|
|
validationMakeStep('lint scripts', 'lint-scripts'), |
|
|
|
|
step.new('check format') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
git fetch origin |
|
|
|
|
make check-format |
|
|
|
|
|||), |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
failCheck: job.new() |
|
|
|
|
+ job.withNeeds([ |
|
|
|
|
'checkFiles', |
|
|
|
|
'faillint', |
|
|
|
|
'golangciLint', |
|
|
|
|
'lintFiles', |
|
|
|
|
'integration', |
|
|
|
|
'testLambdaPromtail', |
|
|
|
|
'testPackages', |
|
|
|
|
'testPushPackage', |
|
|
|
|
]) |
|
|
|
|
+ job.withEnv({ |
|
|
|
|
SKIP_VALIDATION: '${{ inputs.skip_validation }}', |
|
|
|
|
}) |
|
|
|
|
+ job.withIf("${{ !fromJSON(inputs.skip_validation) && (cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure')) }}") |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
step.new('verify checks passed') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
echo "Some checks have failed!" |
|
|
|
|
exit 1, |
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
check: job.new() |
|
|
|
|
+ job.withNeeds([ |
|
|
|
|
'checkFiles', |
|
|
|
|
'faillint', |
|
|
|
|
'golangciLint', |
|
|
|
|
'lintFiles', |
|
|
|
|
'integration', |
|
|
|
|
'testLambdaPromtail', |
|
|
|
|
'testPackages', |
|
|
|
|
'testPushPackage', |
|
|
|
|
]) |
|
|
|
|
+ job.withEnv({ |
|
|
|
|
SKIP_VALIDATION: '${{ inputs.skip_validation }}', |
|
|
|
|
}) |
|
|
|
|
+ job.withSteps([ |
|
|
|
|
common.checkout, |
|
|
|
|
step.new('checks passed') |
|
|
|
|
+ step.withIf('${{ !fromJSON(env.SKIP_VALIDATION) }}') |
|
|
|
|
+ step.withRun(||| |
|
|
|
|
echo "All checks passed" |
|
|
|
|
|||), |
|
|
|
|
]), |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|