-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a50339
commit d74c402
Showing
24 changed files
with
677 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 'Get OCP range' | ||
description: 'Get the range of OCP versions corresponding to the provided range of Kubernetes versions' | ||
inputs: | ||
kube-version-range: | ||
description: 'Range of Kubernetes versions' | ||
required: true | ||
outputs: | ||
ocp-version-range: | ||
description: "Corresponsing range of OCP versions" | ||
value: ${{ steps.run-get-ocp-range.outputs.ocp-version-range }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '>=1.20' | ||
|
||
- name: Install get-ocp-range | ||
shell: bash | ||
run: go install github.com/opdev/getocprange/cmd/get-ocp-range@latest | ||
|
||
- name: Run get-ocp-range | ||
id: run-get-ocp-range | ||
shell: bash | ||
run: | | ||
echo "::debug::Received kubeVersionRange to translate '${{ inputs.kube-version-range }}'" | ||
OCP_VERSION_RANGE=$(get-ocp-range '${{ inputs.kube-version-range }}') | ||
echo "ocp-version-range=$OCP_VERSION_RANGE" >> $GITHUB_OUTPUT | ||
echo "::debug::Successfully translated kubeVersionRange to OCPVersionRange $OCP_VERSION_RANGE" | ||
- name: Display error message if get-ocp-range failed | ||
if: ${{ failure() && steps.run-get-ocp-range.outcome == 'failure' }} | ||
shell: bash | ||
run: echo "::error file=.github/actions/get-ocp-range/action.yaml::Error running get-ocp-range" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Python Style | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
# Only trigger on core script changes | ||
- 'scripts/**.py' | ||
|
||
jobs: | ||
enforce: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python 3.x Part 1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Install style tooling | ||
working-directory: scripts | ||
run: make venv.codestyle | ||
- name: Run formatter | ||
working-directory: scripts | ||
run: make ci.format | ||
# Temporarily auto-pass linting until we are able to manually review and | ||
# address. | ||
- name: Run linter | ||
working-directory: scripts | ||
run: make lint || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
PY_BIN ?= python3 | ||
|
||
# The virtualenv containing code style tools. | ||
VENV_CODESTYLE = venv.codestyle | ||
VENV_CODESTYLE_BIN = $(VENV_CODESTYLE)/bin | ||
|
||
# The virtualenv containing our CI scripts | ||
VENV_TOOLS = venv.tools | ||
VENV_TOOLS_BIN = $(VENV_TOOLS)/bin | ||
|
||
# This is what we pass to git ls-files. | ||
LS_FILES_INPUT_STR ?= 'src/*.py' | ||
|
||
.PHONY: default | ||
default: format lint | ||
|
||
# The same as format, but will throw a non-zero exit code | ||
# if the formatter had to make changes. | ||
.PHONY: ci.format | ||
ci.format: format | ||
git diff --exit-code | ||
|
||
venv.codestyle: | ||
$(MAKE) venv.codestyle.always-reinstall | ||
|
||
# This target will always install the codestyle venv. | ||
# Useful for development cases. | ||
.PHONY: venv.codestyle.always-reinstall | ||
venv.codestyle.always-reinstall: | ||
$(PY_BIN) -m venv $(VENV_CODESTYLE) | ||
./$(VENV_CODESTYLE_BIN)/pip install --upgrade \ | ||
black \ | ||
ruff | ||
|
||
.PHONY: format | ||
format: venv.codestyle | ||
./$(VENV_CODESTYLE_BIN)/black \ | ||
--verbose \ | ||
$$(git ls-files $(LS_FILES_INPUT_STR)) | ||
|
||
.PHONY: lint | ||
lint: venv.codestyle | ||
./$(VENV_CODESTYLE_BIN)/ruff \ | ||
check \ | ||
$$(git ls-files $(LS_FILES_INPUT_STR)) | ||
|
||
venv.tools: | ||
$(MAKE) venv.tools.always-reinstall | ||
|
||
# This target will always install the tools at the venv. | ||
# Useful for development cases. | ||
.PHONY: venv.tools.always-reinstall | ||
venv.tools.always-reinstall: | ||
$(PY_BIN) -m venv $(VENV_TOOLS) | ||
./$(VENV_TOOLS_BIN)/pip install -r requirements.txt | ||
./$(VENV_TOOLS_BIN)/python setup.py install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ignore = [ | ||
"E402", # import ordering (komish): import ordering isn't handled by Black so we need to handle this manually. | ||
"E501", # line length (komish): line length is not enforced by Black so we need to handle these manually. | ||
] |
Oops, something went wrong.