2024-01-04 20:07:57 +00:00
|
|
|
name: Django CI Pipeline
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- release
|
|
|
|
- testing-pipeline
|
|
|
|
|
|
|
|
jobs:
|
2024-01-14 16:33:35 +00:00
|
|
|
test:
|
2024-01-04 20:07:57 +00:00
|
|
|
|
2024-01-09 08:58:00 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2024-01-04 20:07:57 +00:00
|
|
|
|
2024-01-14 16:33:35 +00:00
|
|
|
env:
|
2024-01-14 19:12:17 +00:00
|
|
|
SECRET_KEY: "t3st-dummy-s3cr3t-k3y"
|
2024-01-14 19:16:20 +00:00
|
|
|
STATIC_ROOT: "tmp/static/"
|
|
|
|
MEDIA_ROOT: "tmp/media/"
|
2024-01-14 16:33:35 +00:00
|
|
|
|
2024-01-04 20:07:57 +00:00
|
|
|
steps:
|
2024-01-04 20:20:32 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-04 20:07:57 +00:00
|
|
|
|
2024-01-25 11:05:45 +00:00
|
|
|
- name: Check version and distribution
|
|
|
|
run: |
|
|
|
|
uname -srm
|
|
|
|
lsb_release -a
|
|
|
|
|
2024-01-25 10:48:50 +00:00
|
|
|
- name: Install pre-requisite packages
|
|
|
|
id: prereq
|
|
|
|
run: |
|
|
|
|
apt-get update
|
2024-01-25 10:50:51 +00:00
|
|
|
apt-get install software-properties-common -y
|
2024-01-25 10:48:50 +00:00
|
|
|
|
2024-01-12 08:49:08 +00:00
|
|
|
- name: Install python3-venv
|
2024-01-12 09:00:13 +00:00
|
|
|
id: install
|
2024-01-12 08:49:08 +00:00
|
|
|
run: |
|
2024-01-25 10:45:18 +00:00
|
|
|
add-apt-repository ppa:deadsnakes/ppa
|
2024-01-12 09:18:14 +00:00
|
|
|
apt-get update
|
2024-01-25 10:43:47 +00:00
|
|
|
apt-get install python3.11 python3.11-venv python3.11-pip -y
|
2024-01-25 10:48:50 +00:00
|
|
|
if: steps.prereq.outcome == 'success'
|
2024-01-12 09:18:14 +00:00
|
|
|
|
|
|
|
- name: Check Python version
|
|
|
|
run: |
|
|
|
|
python3 --version
|
2024-01-14 18:46:13 +00:00
|
|
|
echo "Python version: $(python3 --version)"
|
2024-01-12 08:49:08 +00:00
|
|
|
|
2024-01-12 08:47:44 +00:00
|
|
|
- name: Create virtual environment
|
|
|
|
run: |
|
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
2024-01-12 09:25:00 +00:00
|
|
|
echo "Virtual environment created successfully"
|
2024-01-12 09:00:13 +00:00
|
|
|
# https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
|
|
|
|
if: steps.install.outcome == 'success'
|
2024-01-12 08:47:44 +00:00
|
|
|
|
2024-01-25 10:43:47 +00:00
|
|
|
- name: Get DIDKit wheel
|
|
|
|
id: didkit
|
|
|
|
run: |
|
|
|
|
wget https://gitea.pangea.org/trustchain-oc1-orchestral/ssikit_trustchain/raw/branch/master/didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl
|
|
|
|
echo "Successfully downloaded DIDkit"
|
|
|
|
|
2024-01-12 08:47:44 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-01-12 09:25:00 +00:00
|
|
|
source venv/bin/activate
|
2024-01-12 08:47:44 +00:00
|
|
|
pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
2024-01-25 10:43:47 +00:00
|
|
|
if: steps.didkit.outcome == 'success'
|
2024-01-12 08:47:44 +00:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
source venv/bin/activate
|
2024-01-14 18:46:13 +00:00
|
|
|
python manage.py test
|
2024-01-04 20:07:57 +00:00
|
|
|
|