Skip to content

Commit

Permalink
Merge branch 'main' into mta-acceptance-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix authored Aug 30, 2024
2 parents d65d20a + d9e2f90 commit 64709d8
Show file tree
Hide file tree
Showing 47 changed files with 335 additions and 292 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dependency-updates-post-processing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
dependency-updates-post-processing:
name: "Dependency Updates Post-Processing"
if: "!contains(github.event.pull_request.labels.*.name, 'skip-dependency-postprocessing')"
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
Expand Down
84 changes: 9 additions & 75 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,24 @@ jobs:
linters:
name: reviewdog
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Trust my checkout
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: make build-all
run: |
make build-all
- name: get golangci-lint version
id: get-golangci-lint-version
- name: Install devbox
uses: jetify-com/devbox-install-action@a03caf5813591bc882139eba6ae947930a83a427 # v0.11.0
with:
enable-cache: 'true'
- name: Make devbox shellenv available
run: |
version=v$(grep golangci-lint .tool-versions | cut -d " " -f 2 )
echo "golangci-lint version from .tool-versions: '${version}'"
echo "version=${version}" >> "$GITHUB_OUTPUT";
eval "$(devbox shellenv)"
printenv >> $GITHUB_ENV
- name: get go version
id: get-golang-version
- name: Run Go linter
run: |
version="$(grep "golang " .tool-versions| cut -f 2 -d " ")"
echo "Go version from .tool-versions: '${version}'"
echo "version=${version}" >> "$GITHUB_OUTPUT";
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# runs 'bundle install' and caches installed gems automatically
bundler-cache: true
env:
# Needed for self-hosted runner
ImageOS: ubuntu22
make lint-go
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
Expand All @@ -63,53 +47,3 @@ jobs:
uses: reviewdog/action-markdownlint@v0
with:
reporter: github-pr-review

- name: lint acceptance
uses: reviewdog/action-golangci-lint@v2
with:
workdir: src/acceptance
go_version: ${{ steps.get-golang-version.outputs.version }}
golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true

- name: lint go test app
uses: reviewdog/action-golangci-lint@v2
with:
workdir: src/acceptance/assets/app/go_app
go_version: ${{ steps.get-golang-version.outputs.version }}
golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true

- name: lint autoscaler
uses: reviewdog/action-golangci-lint@v2
with:
workdir: src/autoscaler
go_version: ${{ steps.get-golang-version.outputs.version }}
golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true

- name: lint changelog
uses: reviewdog/action-golangci-lint@v2
with:
workdir: src/changelog
go_version: ${{ steps.get-golang-version.outputs.version }}
golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true

- name: lint changeloglockcleaner
uses: reviewdog/action-golangci-lint@v2
with:
workdir: src/changeloglockcleaner
go_version: ${{ steps.get-golang-version.outputs.version }}
golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
act 0.2.64
act 0.2.63
actionlint 1.7.1
bosh 7.3.1
credhub 2.9.29
Expand All @@ -8,7 +8,7 @@ direnv 2.34.0
gcloud 473.0.0
ginkgo 2.20.0
golang 1.22.2
golangci-lint 1.59.1
golangci-lint 1.60.3
java temurin-21.0.3+9.0.LTS
make 4.4
maven 3.8.6
Expand Down
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target/init-db-${db_type}:
@touch $@

.PHONY: clean-autoscaler clean-java clean-vendor clean-acceptance
clean: clean-vendor clean-autoscaler clean-java clean-targets clean-scheduler clean-certs clean-bosh-release clean-build clean-acceptance
clean: clean-vendor clean-autoscaler clean-java clean-targets clean-scheduler clean-certs clean-bosh-release clean-build clean-acceptance ## Clean all build and test artifacts
@make stop-db db_type=mysql
@make stop-db db_type=postgres
clean-build:
Expand Down Expand Up @@ -94,7 +94,7 @@ clean-acceptance:
build: $(all_modules)
build-tests: build-test
build-test: $(addprefix test_,$(go_modules))
build-all: build build-test build-test-app
build-all: build build-test build-test-app ## Build all modules and tests
db: target/db
target/db:
@echo "# building $@"
Expand Down Expand Up @@ -124,7 +124,7 @@ src/scheduler/src/test/resources/certs:


.PHONY: test test-autoscaler test-scheduler test-changelog test-changeloglockcleaner
test: test-autoscaler test-scheduler test-changelog test-changeloglockcleaner test-acceptance-unit
test: test-autoscaler test-scheduler test-changelog test-changeloglockcleaner test-acceptance-unit ## Run all unit tests
test-autoscaler: check-db_type init-db test-certs
@echo ' - using DBURL=${DBURL} TEST=${TEST}'
@make --directory='./src/autoscaler' test DBURL='${DBURL}' TEST='${TEST}'
Expand Down Expand Up @@ -218,32 +218,35 @@ stop-db: check-db_type
@docker rm -f ${db_type} &> /dev/null || echo " - we could not stop and remove docker named '${db_type}'"

.PHONY: integration
integration: build init-db test-certs
integration: build init-db test-certs ## Run all integration tests
@echo " - using DBURL=${DBURL}"
@make --directory='./src/autoscaler' integration DBURL="${DBURL}"


.PHONY: lint
lint: lint-go lint-ruby lint-actions lint-markdown ## Run all linters

.PHONY:lint $(addprefix lint_,$(go_modules))
lint: $(addprefix lint_,$(go_modules)) rubocop
lint-go: build-all $(addprefix lint_,$(go_modules))

rubocop:
lint-ruby:
@echo " - ruby scripts"
@bundle install
@bundle exec rubocop ${RUBOCOP_OPTS} ./spec ./packages

.PHONY: markdownlint
markdownlint: markdownlint-cli
.PHONY: lint-markdown
lint-markdown:
@echo " - linting markdown files"
@markdownlint .
@markdownlint-cli2 .

.PHONY: lint-actions
lint-actions:
@echo " - linting GitHub actions"
go run github.com/rhysd/actionlint/cmd/actionlint@latest
actionlint

$(addprefix lint_,$(go_modules)): lint_%:
@echo " - linting: $(patsubst lint_%,%,$@)"
@pushd src/$(patsubst lint_%,%,$@) >/dev/null && go run github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} run --config ${lint_config} ${OPTS} --timeout 5m
@pushd src/$(patsubst lint_%,%,$@) >/dev/null && golangci-lint run --config ${lint_config} ${OPTS} --timeout 5m

.PHONY: spec-test
spec-test:
Expand Down Expand Up @@ -326,12 +329,8 @@ workspace:
uaac:
which uaac || gem install cf-uaac

.PHONY: markdownlint-cli
markdownlint-cli:
which markdownlint || npm install -g --omit=dev markdownlint-cli

.PHONY: deploy-autoscaler deploy-register-cf deploy-autoscaler-bosh deploy-cleanup
deploy-autoscaler: go-mod-vendor uaac db scheduler deploy-autoscaler-bosh deploy-register-cf
deploy-autoscaler: go-mod-vendor uaac db scheduler deploy-autoscaler-bosh deploy-register-cf ## Deploy autoscaler to OSS dev environment
deploy-register-cf:
echo " - registering broker with cf"
${CI_DIR}/autoscaler/scripts/register-broker.sh
Expand Down Expand Up @@ -376,7 +375,7 @@ build-acceptance-tests:
@make --directory='./src/acceptance' build_tests

.PHONY: acceptance-tests
acceptance-tests: build-test-app acceptance-tests-config
acceptance-tests: build-test-app acceptance-tests-config ## Run acceptance tests against OSS dev environment (requrires a previous deployment of the autoscaler)
@make --directory='./src/acceptance' run-acceptance-tests
.PHONY: acceptance-cleanup
acceptance-cleanup:
Expand All @@ -390,7 +389,7 @@ cleanup-concourse:
@${CI_DIR}/autoscaler/scripts/cleanup-concourse.sh

.PHONY: cf-login
cf-login:
cf-login: ## Login to OSS CF dev environment
@${CI_DIR}/autoscaler/scripts/cf-login.sh

.PHONY: setup-performance
Expand Down Expand Up @@ -457,3 +456,5 @@ deploy-apps:
echo " - deploying apps"
DEBUG="${DEBUG}" ${CI_DIR}/autoscaler/scripts/deploy-apps.sh

help: ## Show this help
@grep --extended-regexp --no-filename '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
9 changes: 5 additions & 4 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
"path:.#log-cache-cli-plugin": "",
"path:.#cloud-mta-build-tool": "",
"path:.#uaac": "",
"act": "0.2.64",
"actionlint": "1.7.1",
"bosh-cli": "7.3.1",
"bundix": "latest",
"cloudfoundry-cli": "8.7.11",
"coreutils": "latest",
"credhub-cli": "2.9.35",
"delve": "latest",
"direnv": "2.34.0",
"fly": "7.10.0",
Expand All @@ -20,7 +18,6 @@
"gnumake": "4.4",
"gnutar": "latest",
"go-tools": "latest",
"golangci-lint": "1.59.1",
"gopls": "latest",
"gum": "0.13.0",
"jq": "latest",
Expand All @@ -37,8 +34,12 @@
"swagger-cli": "latest",
"which": "latest",
"yq-go": "4.44.2",
"google-cloud-sdk": "latest",
"go": "1.22.2",
"credhub-cli": "2.9.29",
"markdownlint-cli2": "latest",
"act": "0.2.63",
"google-cloud-sdk": "latest",
"golangci-lint": "1.60.3",
"temurin-bin-21": "latest",
"ruby": "latest"
},
Expand Down
Loading

0 comments on commit 64709d8

Please sign in to comment.