mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	Test for docker workflow (#4014)
* Test for docker workflow * Ensure yaml is installed in the local env * Install the right package * Debug yaml path * Check data directory first * Let them run * More debug info * Try reverting a recent change * Disable test * Check envvar directory * Remove debug prints * Re-enable unit test * Use os.getenv * Prevent docker workflow from running on pull requests * Re-add InvenTree.helpers import
This commit is contained in:
		
							
								
								
									
										10
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -38,10 +38,10 @@ jobs: | |||||||
|         uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # pin@v4.3.0 |         uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # pin@v4.3.0 | ||||||
|         with: |         with: | ||||||
|           python-version: ${{ env.python_version }} |           python-version: ${{ env.python_version }} | ||||||
|           cache: 'pip' |  | ||||||
|       - name: Version Check |       - name: Version Check | ||||||
|         run: | |         run: | | ||||||
|           pip install requests |           pip install requests | ||||||
|  |           pip install pyyaml | ||||||
|           python3 ci/version_check.py |           python3 ci/version_check.py | ||||||
|           echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |           echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||||||
|           echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV |           echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV | ||||||
| @@ -55,10 +55,6 @@ jobs: | |||||||
|           docker-compose run inventree-dev-server invoke setup-dev |           docker-compose run inventree-dev-server invoke setup-dev | ||||||
|           docker-compose up -d |           docker-compose up -d | ||||||
|           docker-compose run inventree-dev-server invoke wait |           docker-compose run inventree-dev-server invoke wait | ||||||
|       - name: Run Unit Tests |  | ||||||
|         run: | |  | ||||||
|           docker-compose run inventree-dev-server invoke test |  | ||||||
|           docker-compose down |  | ||||||
|       - name: Check Data Directory |       - name: Check Data Directory | ||||||
|         # The following file structure should have been created by the docker image |         # The following file structure should have been created by the docker image | ||||||
|         run: | |         run: | | ||||||
| @@ -71,6 +67,10 @@ jobs: | |||||||
|           test -f data/config.yaml |           test -f data/config.yaml | ||||||
|           test -f data/plugins.txt |           test -f data/plugins.txt | ||||||
|           test -f data/secret_key.txt |           test -f data/secret_key.txt | ||||||
|  |       - name: Run Unit Tests | ||||||
|  |         run: | | ||||||
|  |           docker-compose run inventree-dev-server invoke test | ||||||
|  |           docker-compose down | ||||||
|       - name: Set up QEMU |       - name: Set up QEMU | ||||||
|         if: github.event_name != 'pull_request' |         if: github.event_name != 'pull_request' | ||||||
|         uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2.1.0 |         uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2.1.0 | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ import hmac | |||||||
| import json | import json | ||||||
| import logging | import logging | ||||||
| import math | import math | ||||||
|  | import os | ||||||
| import uuid | import uuid | ||||||
| from datetime import datetime, timedelta | from datetime import datetime, timedelta | ||||||
| from enum import Enum | from enum import Enum | ||||||
| @@ -1371,7 +1372,7 @@ class InvenTreeSetting(BaseInvenTreeSetting): | |||||||
|         'PLUGIN_ON_STARTUP': { |         'PLUGIN_ON_STARTUP': { | ||||||
|             'name': _('Check plugins on startup'), |             'name': _('Check plugins on startup'), | ||||||
|             'description': _('Check that all plugins are installed on startup - enable in container environments'), |             'description': _('Check that all plugins are installed on startup - enable in container environments'), | ||||||
|             'default': settings.DOCKER, |             'default': os.getenv('INVENTREE_DOCKER', False), | ||||||
|             'validator': bool, |             'validator': bool, | ||||||
|             'requires_restart': True, |             'requires_restart': True, | ||||||
|         }, |         }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user