-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (127 loc) · 4.02 KB
/
on-commit-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# run on commit
name: CI-dev
permissions:
contents: write
on:
push:
branches:
- "**"
- "!main"
workflow_dispatch:
env:
TAG_VERSION: v0.0.0
PREVIOUS_TAG: 0.0.0
LATEST_TAG: 0.0.0
TOML_VERSION: 0.0.0
#
RABBITMQ_DEFAULT_USER: test
RABBITMQ_DEFAULT_PASS: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
REDIS_PASS: test
REDIS_COMMANDER_USER: test
REDIS_COMMANDER_PASS: test
DJANGO_SUPER_USER: test
DJANGO_SUPER_PASSWORD: test
DJANGO_SECRET_KEY: django-insecure-test
#
RABBITMQ_WEB_UI_PORT: 15672
RABBITMQ_PORT: 5672
RABBITMQ_HOST: rabbitmq
RABBITMQ_VHOST: /
POSTGRES_PORT: 5432
NGINX_HTTP_PORT: 80
NGINX_HTTPS_PORT: 443
REDIS_PORT: 6379
REDIS_MAXMEMORY: 256mb
REDIS_COMMANDER_PORT: 8081
PORTAINER_PORT: 9000
SWAGGER_PORT: 8956
NODEJS_PORT: 3000
DJANGO_PORT: 8000
DJANGO_DB_HOST: psql
DJANGO_DEBUG: True
DJANGO_ALLOWED_HOSTS: 127.0.0.1,localhost,django
DJANGO_ASYNC_TIMEOUT_S: 30
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP: True
CELERY_BROKER_CONNECTION_RETRY: True
CELERY_BROKER_CONNECTION_MAX_RETRIES: 10
CELERY_BROKER_HEARTBEAT: 10
CELERY_RESULT_BACKEND: rpc://
CELERY_TASK_ACKS_LATE: True
CELERY_TASK_ALWAYS_EAGER: False
CELERY_WORKER_POOL: prefork
CELERY_WORKER_MAX_TASKS_PER_CHILD: 4
CELERY_WORKER_CONCURRENCY: 2
CELERY_WORKER_PREFETCH_MULTIPLIER: 2
CELERY_TASK_IGNORE_RESULT: False
CELERY_WORKER_REDIRECT_STDOUTS: False
CELERY_WORKER_REDIRECT_STDOUTS_LEVEL: INFO
CELERY_WORKER_TASK_LOG_FORMAT: "[%(asctime)s: %(levelname)s] Task %(task_name)s[%(task_id)s]: %(message)s"
jobs:
fetch-commit-message:
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_commit_message.outputs.message }}
steps:
- uses: actions/checkout@v4
- name: "Fetch commit message"
id: get_commit_message
run: echo "::set-output name=message::$(git log -1 --pretty=%B)"
check-no-ci:
runs-on: ubuntu-latest
needs: fetch-commit-message
outputs:
no_ci: ${{ steps.check_no_ci.outputs.no_ci }}
steps:
- name: "Check for [no_ci] in commit message"
id: check_no_ci
run: |
if echo "${{ needs.fetch-commit-message.outputs.commit_message }}" | grep -iq '\[no_ci\]'; then
echo "no_ci=true" >> $GITHUB_OUTPUT
else
echo "no_ci=false" >> $GITHUB_OUTPUT
fi
spellcheck:
runs-on: ubuntu-latest
needs: check-no-ci
if: needs.check-no-ci.outputs.no_ci == 'false'
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Install codespell
shell: bash
run: |
sudo apt-get update || true
sudo apt-get install -y codespell
- name: Run Spellchecker
run: codespell --skip "./frontend/yarn.lock,./papers"
pytest:
# clone whole repo, run docker-compose-build.yml and run tests
runs-on: ubuntu-latest
needs: check-no-ci
if: needs.check-no-ci.outputs.no_ci == 'false'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Create env file from GitHub Environment
# use loop to create env file from env variables
run: |
for key in $(env | grep -E '^[A-Z_]+=' | cut -d= -f1); do
echo "$key=${!key}" >> .env
done
- name: Build and run containers
run: |
docker compose -f docker-compose-build.yml up -d
sleep 20 # Wait for containers to be ready
- name: Run tests
run: docker compose -f docker-compose-build.yml exec -T django pytest