diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..5d4f759 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,89 @@ +# Work in progress, needs `camsai/actions` repository to be present +name: Continuous Testing and Publication + +on: [push] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + run-py-linter: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: + - 3.10.x + + steps: + - name: Checkout this repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Checkout actions repository + uses: actions/checkout@v4 + with: + repository: camsai/actions + token: ${{ secrets.GITHUB_TOKEN }} + path: actions + + - name: Run ruff linter + uses: ./actions/py/lint + with: + python-version: ${{ matrix.python-version }} + + run-py-tests: + needs: run-py-linter + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: + - 3.10.x + - 3.11.x + + steps: + - name: Checkout this repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Checkout actions repository + uses: actions/checkout@v4 + with: + repository: camsai/actions + token: ${{ secrets.GITHUB_TOKEN }} + path: actions + + - name: Run python unit tests + uses: ./actions/py/pytest + with: + python-version: ${{ matrix.python-version }} + unit-test-directory: tests/py/unit + + publish-py-package: + needs: + - run-py-tests + - run-py-linter + runs-on: ubuntu-latest + if: (github.ref_name == 'main') + + steps: + - name: Checkout this repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Checkout actions repository + uses: actions/checkout@v4 + with: + repository: camsai/actions + token: ${{ secrets.GITHUB_TOKEN }} + path: actions + + - name: Publish python release + uses: ./actions/py/publish + with: + python-version: 3.10.12 + github-token: ${{ secrets.GITHUB_TOKEN }} + pypi-api-token: ${{ secrets.PYPI_API_TOKEN }}