Last time "I did an automated test of Pipenv + Pytest with Travis CI", I did an automated test using Travis CI, but Github Actions is now available, so I tried it here as well. The repositories I actually tried are as follows. https://github.com/doara-developer/weatherlib
Github Actions CI / CD tools on Github. It's still in beta, but will soon be standard support. Available by sending a Beta Participation Request. In my case, I passed a few days after I applied. If the application is successful, the Actions tab as shown below will be displayed.
Basically, Workflow can be created by describing "trigger to start processing" and "processing content to be executed" in yaml file. Templates are prepared from the beginning, so if you write based on that, you will not be in trouble so much.
The final yaml file created is below. In this repository, just install Pipenv and the library with Push as a trigger, and hit the command for executing Pytest written in Pipfile. If you're curious about what else you can do, [GitHub Actions Workflow Syntax](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax- Check for-github-actions # jobsjob_id).
name: Run pytest
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pipenv and dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv --upgrade-strategy=only-if-needed
pipenv install --dev
- name: Run test
run: |
pipenv run tests
After creating, you can check the operation status of Workflow by going to the Actions tab. For some reason, the status of Travis CI is also displayed, which is wonderful.
Like Travis CI, Github Actions can create a badge to check the situation and put it on the Readme. Below is the URL of the badge.
https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_NAME>/badge.svg
It was very easy to understand and I was able to execute it without any particular clogging. With standard support, you won't have to use a separate CI service, so Github Actions will probably become mainstream.