diff --git a/.github/workflows/builders.yaml b/.github/workflows/builders.yaml new file mode 100644 index 0000000..2bae5a1 --- /dev/null +++ b/.github/workflows/builders.yaml @@ -0,0 +1,20 @@ +name: Builders +on: + workflow_call: +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: build and install + run: | + pip install . \ No newline at end of file diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml new file mode 100644 index 0000000..47b0d16 --- /dev/null +++ b/.github/workflows/ci-tests.yaml @@ -0,0 +1,23 @@ +name: CI tests +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + +jobs: + lint: + uses: ./.github/workflows/pylint.yaml + + build: + uses: ./.github/workflows/builders.yaml + + tests: + needs: build + uses: ./.github/workflows/tests.yaml + secrets: inherit + diff --git a/.github/workflows/build-push.yaml b/.github/workflows/image-push.yaml similarity index 100% rename from .github/workflows/build-push.yaml rename to .github/workflows/image-push.yaml diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yaml similarity index 91% rename from .github/workflows/pylint.yml rename to .github/workflows/pylint.yaml index 25699ee..075ad9c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yaml @@ -1,25 +1,26 @@ name: Pylint - -on: [push,pull_request] - +on: + workflow_call: jobs: - build: + lint: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.11"] steps: - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install pylint pip install -r requirements.txt - pip install . + - name: Analysing the code with pylint run: | pylint -d C0103 -d R0912 $(git ls-files '*/*.py' '*.py') \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..ee14eda --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,25 @@ +name: Execute tests +on: + workflow_call: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install bats + uses: bats-core/bats-action@1.5.4 + with: + bats-version: 1.10.0 + support-install: false + assert-install: false + detik-install: false + file-install: false + + - name: Execute Tests + run: | + bats -F pretty -T --print-output-on-failure test.bats + env: + TERM: linux + ES_SERVER: ${{ secrets.ES_SERVER }} + ES_INDEX: ${{ secrets.ES_INDEX }} \ No newline at end of file diff --git a/test.bats b/test.bats new file mode 100644 index 0000000..6c908b7 --- /dev/null +++ b/test.bats @@ -0,0 +1,13 @@ +#!/usr/bin/env bats +# vi: ft=bash +# shellcheck disable=SC2086,SC2030,SC2031,SC2164 + + +run_cmd(){ + echo "$@" + ${@} +} + +@test "orion test" { + run_cmd orion --help +} \ No newline at end of file