Skip to content

Commit

Permalink
merged .github update
Browse files Browse the repository at this point in the history
  • Loading branch information
mlodic committed Aug 30, 2024
2 parents 55ff68a + 88e5479 commit 5e84305
Show file tree
Hide file tree
Showing 18 changed files with 1,304 additions and 884 deletions.
4 changes: 4 additions & 0 deletions .github/.github/hooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Restore hard links
cp -rfl {workflows,actions,configurations} .github/
6 changes: 3 additions & 3 deletions .github/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 7.1.1
hooks:
- id: flake8
args: ["--config", ".github/configurations/python_linters/.flake8"]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--settings-path", ".github/configurations/python_linters/.isort.cfg", "--filter-files", "--skip", "venv"]

- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.8.0
hooks:
- id: black
args: ["--config", ".github/configurations/python_linters/.black"]
2 changes: 1 addition & 1 deletion .github/actions/apt_requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ runs:

- name: Cache apt packages
id: cache-apt-packages
uses: awalsh128/cache-apt-pkgs-action@v1
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: ${{ steps.export-apt-requirements.outputs.apt_packages }}
2 changes: 1 addition & 1 deletion .github/actions/python_linter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
- name: Pylint formatter
run: |
if [[ ${{ inputs.use_pylint }} != 'false' ]]; then
pylint . --rcfile ${GITHUB_WORKSPACE}/.github/configurations/python_linters/.pylintrc
pylint * --rcfile ${GITHUB_WORKSPACE}/.github/configurations/python_linters/.pylintrc --ignore-patterns ".*(?<!py)$"
else
echo "Skipping pylint formatter"
fi
Expand Down
67 changes: 40 additions & 27 deletions .github/actions/services/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ inputs:
description: Use mongo service
required: true


postgres_db:
description: Postgres service db. Requires use_postgres to be true
required: true
Expand All @@ -34,17 +33,36 @@ inputs:
description: Postgres alpine version
required: true

mongo_version:
description: Mongo container version
required: true
elasticsearch_version:
description: Elasticsearch container version
required: true
elasticsearch_port:
description: Elasticsearch container exposed port
required: true
memcached_version:
description: Memcached alpine container version
required: true
redis_version:
description: Redis alpine container version
required: true
rabbitmq_version:
description: RabbitMQ management-alpine container version
required: true


runs:
using: "composite"
steps:

- name: Create mongo docker-compose file
- name: Create mongo docker compose file
if: inputs.use_mongo
run: |
echo "version: '3.7'" > mongo.yml
echo "services:" >> mongo.yml
echo "services:" > mongo.yml
echo " mongo:" >> mongo.yml
echo " image: library/mongo:4.4" >> mongo.yml
echo " image: library/mongo:${{ inputs.mongo_version }}" >> mongo.yml
echo " container_name: mongo" >> mongo.yml
echo " ports:" >> mongo.yml
echo " - 27017:27017" >> mongo.yml
Expand All @@ -55,11 +73,10 @@ runs:
shell:
bash

- name: Create postgres docker-compose file
- name: Create postgres docker compose file
if: inputs.use_postgres
run: |
echo "version: '3.7'" > postgres.yml
echo "services:" >> postgres.yml
echo "services:" > postgres.yml
echo " postgres:" >> postgres.yml
echo " image: library/postgres:${{ inputs.postgres_version }}-alpine" >> postgres.yml
echo " container_name: postgres" >> postgres.yml
Expand All @@ -77,19 +94,18 @@ runs:
shell:
bash

- name: Create elasticsearch docker-compose file
- name: Create elasticsearch docker compose file
if: inputs.use_elastic_search
run: |
echo "version: '3.7'" > elastic_search.yml
echo "services:" >> elastic_search.yml
echo "services:" > elastic_search.yml
echo " elastic_search:" >> elastic_search.yml
echo " image: elasticsearch:7.10.1" >> elastic_search.yml
echo " image: elasticsearch:${{ inputs.elasticsearch_version }}" >> elastic_search.yml
echo " container_name: elastic_search" >> elastic_search.yml
echo " environment:" >> elastic_search.yml
echo " ES_JAVA_OPTS: -Xms1g -Xmx1g" >> elastic_search.yml
echo " discovery.type: single-node" >> elastic_search.yml
echo " ports:" >> elastic_search.yml
echo " - 59200:9200" >> elastic_search.yml
echo " - ${{ inputs.elasticsearch_port }}:9200" >> elastic_search.yml
echo " healthcheck:" >> elastic_search.yml
echo " test: curl -X GET 'localhost:9200/_cluster/health?wait_for_status=yellow&timeout=180s&pretty'" >> elastic_search.yml
echo " interval: 10s" >> elastic_search.yml
Expand All @@ -98,49 +114,46 @@ runs:
shell:
bash

- name: Create memcached docker-compose file
- name: Create memcached docker compose file
if: inputs.use_memcached
run: |
echo "version: '3.7'" > memcached.yml
echo "services:" >> memcached.yml
echo "services:" > memcached.yml
echo " memcached:" >> memcached.yml
echo " container_name: memcached" >> memcached.yml
echo " image: memcached:1.6.9-alpine" >> memcached.yml
echo " image: memcached:${{ inputs.memcached_version }}-alpine" >> memcached.yml
echo " ports:" >> memcached.yml
echo " - 11211:11211" >> memcached.yml
shell:
bash

- name: Create redis docker-compose file
- name: Create redis docker compose file
if: inputs.use_redis
run: |
echo "version: '3.7'" > redis.yml
echo "services:" >> redis.yml
echo "services:" > redis.yml
echo " redis:" >> redis.yml
echo " container_name: redis" >> redis.yml
echo " image: library/redis:5.0.9-alpine" >> redis.yml
echo " image: library/redis:${{ inputs.redis_version }}-alpine" >> redis.yml
echo " ports:" >> redis.yml
echo " - 6379:6379" >> redis.yml
shell:
bash

- name: Create rabbitmq docker-compose file
- name: Create rabbitmq docker compose file
if: inputs.use_rabbitmq
run: |
echo "version: '3.7'" > rabbitmq.yml
echo "services:" >> rabbitmq.yml
echo "services:" > rabbitmq.yml
echo " rabbitmq:" >> rabbitmq.yml
echo " container_name: rabbitmq" >> rabbitmq.yml
echo " image: library/rabbitmq:3.9-management-alpine" >> rabbitmq.yml
echo " image: library/rabbitmq:${{ inputs.rabbitmq_version }}-management-alpine" >> rabbitmq.yml
echo " ports:" >> rabbitmq.yml
echo " - 15672:15672" >> rabbitmq.yml
echo " - 5672:5672" >> rabbitmq.yml
shell:
bash

- name: Execute docker-compose up
- name: Execute docker compose up
run: |
CLI=docker-compose
CLI="docker compose"
if [[ ${{ inputs.use_postgres }} != 'false' ]]; then
CLI="${CLI} -f postgres.yml"
fi
Expand Down
12 changes: 12 additions & 0 deletions .github/configurations/node_linters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,22 @@ Here are some examples:
In `.vscode/settings.json`
```json
{
"editor.formatOnSave": true,
"eslint.options": {
"overrideConfigFile": ".github/configurations/node_linters/eslint/.eslintrc.json"
},
"eslint.format.enable": true,
"stylelint.configFile": ".github/configurations/node_linters/stylelint/.stylelintrc.json",
"stylelint.validate": ["css", "less", "postcss", "scss"],
"stylelint.snippet": ["css", "less", "postcss", "scss"],
"prettier.configPath": ".github/configurations/node_linters/prettier/.prettierrc.js",
"editor.semanticHighlighting.enabled": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
```
Loading

0 comments on commit 5e84305

Please sign in to comment.