Merge pull request #1314 from syucream/fix/use-msw-more #1076
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build core (Python / Django) | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
paths: | |
- "**/*.py" | |
- "templates/**/*.html" | |
- ".github/workflows/build-core.yml" | |
- "poetry.lock" | |
jobs: | |
lint: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11.5" | |
cache: "poetry" | |
- name: apt-get | |
run: | | |
sudo apt-get update | |
sudo apt-get install libldap2-dev libsasl2-dev libxmlsec1-dev libmysqlclient-dev pkg-config | |
- name: poetry install | |
run: | | |
poetry install --no-ansi | |
- name: staticchecks | |
run: | | |
mv custom_view_sample custom_view | |
poetry run mypy ./ | |
poetry run ruff check --output-format=github . | |
poetry run ruff format --check . | |
# set modules have python test code outputs.modules | |
setup_python311: | |
runs-on: ubuntu-24.04 | |
outputs: | |
targets: ${{ steps.modules.outputs.targets }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: modules | |
run: | | |
mv custom_view_sample custom_view | |
modules=$(ls -d */tests/ | sed 's/\/tests\///' | jq -Rsc 'split("\n")[:-1]') | |
echo "targets=$modules" >> $GITHUB_OUTPUT | |
python311: | |
runs-on: ubuntu-24.04 | |
needs: setup_python311 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{ fromJson(needs.setup_python311.outputs.targets) }} | |
services: | |
rabbitmq: | |
image: rabbitmq:3.8.19-management | |
ports: | |
- 5672:5672 | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6 | |
ports: | |
- 9200:9200 | |
env: | |
discovery.type: single-node | |
ES_JAVA_OPTS: -Xms512m -Xmx512m | |
options: >- | |
--health-cmd "curl http://localhost:9200/_cluster/health" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mysql: | |
image: mysql:8.0.36 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_USER: airone | |
MYSQL_PASSWORD: password | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: airone | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11.5" | |
cache: "poetry" | |
- name: Install additional dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libldap2-dev libsasl2-dev libxmlsec1-dev default-mysql-client default-libmysqlclient-dev | |
- name: Prepare MySQL | |
run: | | |
mysql -protocol=tcp -uroot -h127.0.0.1 -ppassword -e "SET GLOBAL character_set_server=utf8; SET GLOBAL collation_server=utf8_general_ci; SET GLOBAL default_storage_engine=InnoDB;" | |
mysql -protocol=tcp -uroot -h127.0.0.1 -ppassword -e "GRANT ALL ON *.* to airone@'%'" | |
- name: poetry install | |
run: | | |
poetry install --no-ansi | |
- name: test | |
run: | | |
mv custom_view_sample custom_view | |
poetry run python manage.py makemigrations | |
poetry run python manage.py migrate | |
poetry run python manage.py collectstatic | |
poetry run coverage run manage.py test ${{ matrix.target }} --parallel | |
poetry run coverage report | |
poetry run coverage xml | |
- name: coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: core/${{ matrix.target }} | |
continue-on-error: true |