IdHub/.gitea/workflows/ci-pipeline.yaml

90 lines
2.2 KiB
YAML
Raw Normal View History

name: Django CI Pipeline
on:
push:
branches:
- main
- release
- testing-pipeline
pull_request:
branches:
- main
- release
jobs:
2024-01-14 16:33:35 +00:00
test:
runs-on: self-hosted
2024-01-14 16:33:35 +00:00
env:
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
steps:
2024-01-04 20:20:32 +00:00
- uses: actions/checkout@v4
2024-01-25 11:05:45 +00:00
- name: Check version and distribution
run: |
uname -srm
2024-01-25 11:07:14 +00:00
cat /etc/os-release
2024-01-25 11:05:45 +00:00
2024-01-12 08:49:08 +00:00
- name: Install python3-venv
id: install
2024-01-12 08:49:08 +00:00
run: |
apt-get update
apt-get install python3 python3-venv python3-pip -y
- name: Check Python version
run: |
python3 --version
2024-01-12 08:49:08 +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"
# https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
if: steps.install.outcome == 'success'
- name: Get DIDKit wheel
id: didkit
run: |
wget -O didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl https://gitea.pangea.org/api/v1/repos/trustchain-oc1-orchestral/ssikit_trustchain/raw/didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl?token=${{ secrets.FILE_GETTER_TOKEN }}
echo "Successfully downloaded DIDkit"
- name: Install dependencies
run: |
2024-01-12 09:25:00 +00:00
source venv/bin/activate
2024-01-25 11:51:46 +00:00
which python
pip -V
pip install --upgrade pip
2024-01-25 11:51:46 +00:00
pip -V
python -V
pip install -r requirements.txt
if: steps.didkit.outcome == 'success'
- name: Run tests
run: |
source venv/bin/activate
python manage.py test
deploy:
needs: test
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Trigger Remote Script
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST http://45.150.187.54:5000/trigger-script -H "Authorization: SecretToken")
2024-02-01 20:05:28 +00:00
if [ "$response" -ne 200 ]; then
echo "Script execution failed with HTTP status $response"
exit 1
else
echo "Script execution successful"
exit 0
2024-02-01 20:05:28 +00:00
fi
if: success() && github.ref == 'refs/heads/release'