updated dates and times #200
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: Pytest CI | |
on: | |
push: | |
branches: | |
- version-14 | |
- version-15 | |
pull_request: | |
permissions: | |
contents: write | |
checks: write | |
issues: write | |
pull-requests: write | |
jobs: | |
tests: | |
name: Server | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:10.6 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: YES | |
MYSQL_ROOT_PASSWORD: 'admin' | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
check-latest: true | |
cache: 'yarn' # Replaces `Get yarn cache directory path` and `yarn-cache` steps | |
# Uncomment if running locally, remove after local testing (already available in github actions environment) | |
# - name: Install Yarn | |
# run: npm install -g yarn | |
- name: Add to Hosts | |
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
# - name: Get yarn cache directory path | |
# id: yarn-cache-dir-path | |
# run: 'echo "::set-output name=dir::$(yarn cache dir)"' | |
# - uses: actions/cache@v3 | |
# id: yarn-cache | |
# with: | |
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-yarn- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Install JS Dependencies | |
run: yarn --prefer-offline | |
- name: Install App Dependencies | |
run: bash ${{ github.workspace }}/.github/helper/install_dependencies.sh | |
- name: Install Bench Site and Apps | |
env: | |
MYSQL_HOST: 'localhost' | |
MYSQL_PWD: 'admin' | |
run: bash ${{ github.workspace }}/.github/helper/install.sh | |
- name: Install Test Fixtures | |
working-directory: /home/runner/frappe-bench | |
run: | | |
bench execute 'inventory_tools.tests.setup.before_test' | |
- name: Run Tests | |
working-directory: /home/runner/frappe-bench | |
run: | | |
source env/bin/activate | |
cd apps/inventory_tools | |
poetry install | |
pytest --cov=inventory_tools --cov-report=xml --disable-warnings -s | tee pytest-coverage.txt | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: /home/runner/frappe-bench/apps/inventory_tools/pytest-coverage.txt | |
junitxml-path: /home/runner/frappe-bench/apps/inventory_tools/coverage.xml |