From c49b35741c3be7c3aa8ed53a0cf43dbc003b5dc9 Mon Sep 17 00:00:00 2001 From: Simeon Ehrig Date: Tue, 23 Jan 2024 14:25:17 +0100 Subject: [PATCH] add GitHub Action for unit tests --- .github/workflows/codeCoverage.yml | 2 +- .github/workflows/testDeploy.yml | 31 ++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/testDeploy.yml diff --git a/.github/workflows/codeCoverage.yml b/.github/workflows/codeCoverage.yml index 791ece8..b9608bd 100644 --- a/.github/workflows/codeCoverage.yml +++ b/.github/workflows/codeCoverage.yml @@ -11,7 +11,7 @@ jobs: with: fetch-depth: 2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.12 - name: Install bashi diff --git a/.github/workflows/testDeploy.yml b/.github/workflows/testDeploy.yml new file mode 100644 index 0000000..32f8461 --- /dev/null +++ b/.github/workflows/testDeploy.yml @@ -0,0 +1,31 @@ +name: test-and-deploy +on: [push, pull_request] +jobs: + formatter: + name: runner black code formatter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: rickstaa/action-black@v1 + with: + black_args: ". --check" + + unit-tests: + runs-on: ubuntu-latest + needs: formatter + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + name: Run unit tests with Python ${{ matrix.python-version }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: Install bashi + run: | + pip install . + - name: run unit tests + run: python -m unittest discover -s tests diff --git a/README.md b/README.md index 5e75f4e..cc70800 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ It is strongly recommended to use a Python environment for developing the code, 2. Activate the environment: `source env/bin/activate` 3. Install the library: `pip install --editable .` 4. Test the installation with the example: `python3 example/example.py` -5. You can run the unit tests by going to the `test` directory and running `python -m unittest` +5. You can run the unit tests by going to the `test` directory and running `python -m unittest discover -s tests` If the example works correctly, a `job.yml` will be created in the current directory. You can also run `python3 example/example.py --help` to see additional options.