---
on:
push:
branches: ['master']
jobs:
have-faith:
runs-on: ubuntu-latest
steps:
- run: echo "Good luck! 🤞"
---
on:
push:
pull_request:
workflow_dispatch:
schedule: '0 12 * * *'
jobs:
test:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest -vv
jobs:
test:
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest -vv
jobs:
build:
steps:
- name: Create container image
run: >
guix pack -f docker
--root=nivlheim-image.tar.gz
--entry-point=bin/nivlheim
-S /etc/profile=etc/profile
--with-source=nivlheim=$PWD
nivlheim
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: nivlheim-image.tar.gz
path: nivlheim-image.tar.gz
jobs:
build:
steps:
[...]
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: nivlheim-image.tar.gz
path: nivlheim-image.tar.gz
publish:
if: ${{ github.ref == 'refs/heads/master' }}
needs: build
steps:
- name: Download artifact
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
mreg:
image: ghcr.io/unioslo/mreg:latest
env:
MREG_DB_HOST: postgres
ports:
- 8000:8000
steps:
- run: >
echo -ne 'test\nsource testsuite\nquit\n'
| mreg-cli -u ci --url http://localhost:8000
The source of this presentation is available at https://github.com/mbakke/github-actions-intro.
Code samples were taken from:
Official GitHub documentation can be found at https://docs.github.com/en/actions/reference.