A large group of people have started using GitHub Actions. Mainly, as they are moving from Travis-CI for their GitHub repos. I already know how to use Travis-CI but never tried GitHub Actions before. I think it won’t take much time to learn its basics. So let’s dive into it.
I can’t find a better introduction for this than their official docs: #1 https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions
It cleared up a lot of terminologies, and by giving the working examples. They have made it a good introductory tutorial. Moving on the part two now: #2 https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/finding-and-customizing-actions
I didn’t read #2 completely, want to read more about the syntax first #3 https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/finding-and-customizing-actions
Just quickly skimmed through #3 YAML examples and headings of syntax.
Now, I think I should try implementing it on one of my project that was using Travis-CI so far. Here is my project #4 https://github.com/GeekyShacklebolt/nickoscope
Let me write a GitHub workflow file for it. In the project_root/.github/workflows/main.yml
name: Run Tests for Nickoscope
on: [push, pull_request]
jobs:
build-and-run-tests:
runs-on: ubuntu-latest
steps:
- name: Get Action V2
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Requirements
run: |
python -m pip install --upgrade pip
pip3 install -r requirements.txt
- name: Run flake8
run: |
flake8
Commit this file and push to your repository.
I got YAML syntax error on the first attempt. -_-
Corrected it and pushed through a PR this time.
There we go. It is working!!!
Now, whenever I would have to use GitHub actions for some new requirements like new actions, services, etc, I can just read their official docs for that specific requirement.
Great then. Thanks for following up so far!