From 5268b41599ab520d617b69a3096e8145e2632fd4 Mon Sep 17 00:00:00 2001 From: "M. Rehan" Date: Tue, 4 Oct 2022 13:24:23 +0500 Subject: [PATCH] Add git workflows for linting and json check --- .github/workflows/json_format_validation.yaml | 15 +++++++++++ .github/workflows/lint.yaml | 27 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/json_format_validation.yaml create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/json_format_validation.yaml b/.github/workflows/json_format_validation.yaml new file mode 100644 index 0000000000..046e6670c4 --- /dev/null +++ b/.github/workflows/json_format_validation.yaml @@ -0,0 +1,15 @@ +name: json_format + +on: [push] + +jobs: + validation: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Validate json format + run: | + find -name upgrade_info.json -exec sh -c "cat {} | jq && exit 0 || echo $? >> .exit_status" \; + test -f jq_exit_status && rm .exit_status && exit 1; exit 0; diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000000..78bb9d337c --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,27 @@ +name: flake8 + +on: [push] + +jobs: + lint: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + - name: Setup flake8 config + run: | + echo '[flake8]' > setup.cfg + echo 'max-line-length = 120' >> setup.cfg + - name: Analysing the code with flake8 + run: | + find -name upgrade_strategy -exec sh -c "flake8 {} && exit 0 || echo $? > .exit_status" \; + test -f .exit_status && rm .exit_status && exit 1; exit 0;