docs: fix mssql link #195
Workflow file for this run
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: release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version to publish (3.7, 3.8, all,...) (only one) | |
required: true | |
push: | |
branches: | |
- 'main' | |
- 'feature/*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_DATABASE: test_db | |
MYSQL_USER: test_user | |
MYSQL_PASSWORD: password | |
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
MYSQL_PORT: 33061 | |
MARIADB_HOST: 127.0.0.1 | |
MARIADB_DATABASE: test_db | |
MARIADB_USER: test_user | |
MARIADB_PASSWORD: password | |
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'yes' | |
MARIADB_PORT: 33062 | |
MARIADB_MYSQL_LOCALHOST_USER: true | |
POSTGRES_HOST: 127.0.0.1 | |
POSTGRES_DB: test_db | |
POSTGRES_USER: test_user | |
POSTGRES_PASSWORD: password | |
POSTGRES_PORT: 5432 | |
MSSQL_HOST: 127.0.0.1 | |
MSSQL_DATABASE: test_db | |
MSSQL_USER: sa | |
MSSQL_PASSWORD: yourStrong(!)Password | |
MSSQL_PORT: 1433 | |
services: | |
# Label used to access the service container | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2019-latest | |
env: | |
MSSQL_SA_PASSWORD: ${{env.MSSQL_PASSWORD}} | |
ACCEPT_EULA: Y | |
ports: | |
- 1433:1433 | |
# todo: dont hardcode password | |
# options: >- | |
# --health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P yourStrong(!)Password -Q 'SELECT 1' -b -o /dev/null" | |
# --health-interval 60s | |
# --health-timeout 30s | |
# --health-start-period 20s | |
# --health-retries 3 | |
mysql: | |
image: mysql | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: ${{env.MYSQL_ALLOW_EMPTY_PASSWORD}} | |
MYSQL_USER: ${{env.MYSQL_USER}} | |
MYSQL_PASSWORD: ${{env.MYSQL_PASSWORD}} | |
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_ROOT_PASSWORD}} | |
MYSQL_DATABASE: ${{env.MYSQL_DATABASE}} | |
ports: | |
- 33061:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
mariadb: | |
image: mariadb | |
env: | |
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: ${{env.MARIADB_ALLOW_EMPTY_ROOT_PASSWORD}} | |
MARIADB_USER: ${{env.MARIADB_USER}} | |
MARIADB_PASSWORD: ${{env.MARIADB_PASSWORD}} | |
MARIADB_DATABASE: ${{env.MARIADB_DATABASE}} | |
MARIADB_MYSQL_LOCALHOST_USER: ${{env.MARIADB_MYSQL_LOCALHOST_USER}} | |
ports: | |
- 33062:3306 | |
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_DB: ${{env.POSTGRES_DB}} | |
POSTGRES_USER: ${{env.POSTGRES_USER}} | |
POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
version: [ "3.7","3.8","3.9","3.10","3.11", ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- '${{matrix.version}}/**' | |
docker: | |
- 'Dockerfile' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Python Docker image | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: docker build ./${{matrix.version}} --tag my-temp-python-image:latest | |
- name: Set actual python version | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: echo "PYTHON_VERSION=$(docker run my-temp-python-image:latest python -V 2>&1 | grep -Po '(?<=Python )(.+)')" >> $GITHUB_ENV | |
- name: Build the Docker image | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: docker build . --tag orbisk/django-test:${{env.PYTHON_VERSION}} --tag orbisk/django-test:${{matrix.version}} | |
- name: Mysql Grant | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: | | |
echo "GRANT ALL on *.* to '${{env.MYSQL_USER}}';"| mysql -u root -h ${{env.MYSQL_HOST}} --port=${{env.MYSQL_PORT}} | |
- name: MariaDB Grant | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: | | |
echo "GRANT ALL on *.* to '${{env.MARIADB_USER}}';"| mysql -u root -h ${{env.MARIADB_HOST}} --port=${{env.MARIADB_PORT}} | |
- name: Test Databases | |
if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version | |
run: | | |
docker run --network host -v /"$(pwd)/tests":/app -w /app -e MYSQL_HOST=$MYSQL_HOST -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_USER=$MYSQL_USER -e MYSQL_PORT=$MYSQL_PORT -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MARIADB_HOST=$MARIADB_HOST -e MARIADB_DATABASE=$MARIADB_DATABASE -e MARIADB_USER=$MARIADB_USER -e MARIADB_PORT=$MARIADB_PORT -e MARIADB_PASSWORD=$MARIADB_PASSWORD -e POSTGRES_HOST=$POSTGRES_HOST -e POSTGRES_DB=$POSTGRES_DB -e POSTGRES_USER=$POSTGRES_USER -e POSTGRES_PORT=$POSTGRES_PORT -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -e MSSQL_HOST -e MSSQL_PORT -e MSSQL_DATABASE -e MSSQL_USER -e MSSQL_PASSWORD orbisk/django-test:${{env.PYTHON_VERSION}} sh -c "cd /app && pip install -r requirements.txt && python manage.py test" | |
- name: Push Image | |
if: (steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version) && github.ref == 'refs/heads/main' | |
run: docker push -a orbisk/django-test |