diff --git a/.github/workflows/builders.yaml b/.github/workflows/builders.yaml new file mode 100644 index 0000000..778801e --- /dev/null +++ b/.github/workflows/builders.yaml @@ -0,0 +1,18 @@ +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 92% rename from .github/workflows/pylint.yml rename to .github/workflows/pylint.yaml index 25699ee..8e777c7 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yaml @@ -1,7 +1,6 @@ name: Pylint - -on: [push,pull_request] - +on: + workflow_call: jobs: build: runs-on: ubuntu-latest @@ -19,7 +18,6 @@ jobs: 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..3795a43 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,31 @@ +name: Execute tests +on: + workflow_call: +jobs: + tests: + runs-on: ubuntu-latest + steps: + + - 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: Checkout code + uses: actions/checkout@v2 + + - name: List files + run: ls -R + + - name: Execute Tests + run: | + ls -la + 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..2fc2582 --- /dev/null +++ b/test.bats @@ -0,0 +1,8 @@ +#!/usr/bin/env bats +# vi: ft=bash +# shellcheck disable=SC2086,SC2030,SC2031,SC2164 + + +@test "orion test" { + run_cmd orion --help +} \ No newline at end of file