feat: Handler 'partial driving time' messages #126
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: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
pre-clean-badge: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Clean coverage badge | |
run: | | |
curl -s https://github.com/DimasDMM/live-timing-strategy/blob/master/README.md > README.md.tmp | |
grep -Eo '<img src="[^"]+"' README.md.tmp | grep camo | grep -Eo 'https[^"]+' | xargs -I {} curl -w "\n" -s -X PURGE {} | |
test-lts-pipeline: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Load environment variables | |
uses: cardinalby/export-env-action@v2 | |
with: | |
envFile: 'lts-pipeline/.env.local' | |
expand: 'true' | |
- name: Prepare network of Docker | |
run: | | |
docker network create lts-network | |
- name: Start API of LTS | |
run: | | |
cd lts-api | |
docker build --tag lts-api . | |
docker run -d --name lts-api --network lts-network --env-file .env.indocker -p ${{ env.API_PORT }}:80 lts-api | |
- name: Start MySQL | |
run: | | |
docker run -d --name lts-mysql --network lts-network -p ${{ env.DB_PORT }}:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.1.0 | |
- name: Install dependencies | |
run: | | |
cd lts-pipeline | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
poetry install | |
- name: Wait for MySQL | |
run: | | |
sh ./lts-api/bin/wait-database.sh | |
- name: Wait for API REST | |
run: | | |
sh ./lts-api/bin/wait-api.sh | |
- name: Run tests | |
run: | | |
cd lts-pipeline | |
tox -e 'py310-test' | |
poetry run coverage-badge -o "docs/coverage.svg" -f | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v13 | |
id: verify-changed-files | |
with: | |
files: lts-pipeline/docs/coverage.svg | |
- name: Commit files | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git add lts-pipeline/docs/coverage.svg | |
git commit -m "ci: Update lts-pipeline coverage.svg" | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
branch: ${{ github.ref }} | |
linter-lts-pipeline: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
- name: Run linter | |
run: | | |
cd lts-pipeline | |
tox -e 'py310-lint' | |
mypy-lts-pipeline: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
- name: Run MyPy | |
run: | | |
cd lts-pipeline | |
tox -e 'py310-mypy' | |
test-lts-api: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Load environment variables | |
uses: cardinalby/export-env-action@v2 | |
with: | |
envFile: 'lts-api/.env.local' | |
expand: 'true' | |
- name: Start MySQL | |
run: | | |
docker run -d --name lts-mysql -p ${{ env.DB_PORT }}:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.1.0 | |
- name: Install dependencies | |
run: | | |
cd lts-api | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
poetry install | |
- name: Wait for MySQL | |
run: | | |
sh ./lts-api/bin/wait-database.sh | |
- name: Run tests | |
run: | | |
cd lts-api | |
tox -e 'py310-test' | |
poetry run coverage-badge -o "docs/coverage.svg" -f | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v13 | |
id: verify-changed-files | |
with: | |
files: lts-api/docs/coverage.svg | |
- name: Commit files | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git add lts-api/docs/coverage.svg | |
git commit -m "ci: Update lts-api coverage.svg" | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
branch: ${{ github.ref }} | |
linter-lts-api: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
- name: Run linter | |
run: | | |
cd lts-api | |
tox -e 'py310-lint' | |
mypy-lts-api: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: pre-clean-badge | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox==4.11 poetry==1.6.1 | |
- name: Run MyPy | |
run: | | |
cd lts-api | |
tox -e 'py310-mypy' | |
post-clean-badge: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: | |
- test-lts-api | |
- test-lts-pipeline | |
- linter-lts-api | |
- linter-lts-pipeline | |
- mypy-lts-api | |
- mypy-lts-pipeline | |
steps: | |
- name: Clean coverage badge | |
run: | | |
curl -s https://github.com/DimasDMM/live-timing-strategy/blob/master/README.md > README.md.tmp | |
grep -Eo '<img src="[^"]+"' README.md.tmp | grep camo | grep -Eo 'https[^"]+' | xargs -I {} curl -w "\n" -s -X PURGE {} |