CI for sdk-py Python packages
sdk-py is a Decentralized Instant Messaging (SDK in Python). It has a tests directory with a test.py file in it that has some Unit-test-based tests.
After playing with a bit locally I found out - something I was missing in a previous package - that I can use the -e flag for pip install to install the dependencies.
I also found out that in order to make the tests work in this project I have to install the dependencies from both the root directory and from the plugins directory. Once this was cleared setting up the CI was easy.
Here is the pull-request
GitHub Actions configuration
examples/python/sdk-py/ci.yml
name: CI on: push: pull_request: workflow_dispatch: schedule: - cron: '42 5 * * *' jobs: test: strategy: fail-fast: false matrix: runner: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.9", "3.10", "3.11"] runs-on: ${{matrix.runner}} name: OS ${{matrix.runner}} Python ${{matrix.python-version}} steps: - name: Checkout uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | pip install -e . cd plugins pip install -e . cd .. - name: Check Python version run: python -V - name: Test run: python tests/test.py
Conclusion
I think I am a bit tired of this daily CI work. For example this is for day 12, but I already prepared it on Day 11 and I am not sure I have the self-discipline to hold it back and only publish it tomorrow. Especially as I already sent the PR. (Well, I had, so I am publishing this article really on December 12.)
Moreover, now that I sent a PR I would like to go on and try to send a few more. Then maybe for a few days I would not do any.
In addition I think I am letting my readers and certainly myself down by repeatedly doing similar work. At the beginning there were a few interesting ones with databases, but that required way too much work to sustain on a daily base. In addition, I found them by chance. If I'd like to have more of these I should look for them. It probably would not be too difficult to find a Python project that uses some X database, but then it also needs to be one that does not have a CI.
Anyway, it is a good experiment.
Published on 2022-12-12