Skip to content

lint-and-unit-tests #489

lint-and-unit-tests

lint-and-unit-tests #489

name: lint-and-unit-tests
on:
pull_request:
push:
branches:
- main
- master
schedule:
- cron: 0 1 * * *
workflow_dispatch:
jobs:
build-and-test-python:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Clone StackStorm/st2 repo
run: |
make .clone_st2_repo
- name: Download and install depedencies
run: |
sudo apt-get update
sudo apt-get -y install libldap2-dev libsasl2-dev
sudo apt-get -y install python3-virtualenv
make requirements
- name: Run lint and tests (Python ${{ matrix.python-version }})
run: |
make .lint
make .unit-tests
set_merge_ok:
name: Set Merge OK
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
needs:
- build-and-test-python
outputs:
merge_ok: ${{ steps.set_merge_ok.outputs.merge_ok }}
runs-on: ubuntu-latest
steps:
- id: set_merge_ok
run: echo 'merge_ok=true' >> ${GITHUB_OUTPUT}
merge_ok:
name: Merge OK
if: always()
needs:
- set_merge_ok
runs-on: ubuntu-latest
steps:
- run: |
merge_ok="${{ needs.set_merge_ok.outputs.merge_ok }}"
if [[ "${merge_ok}" == "true" ]]; then
echo "Merge OK"
exit 0
else
echo "Merge NOT OK"
exit 1
fi