Run 2.x tests #915
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: Run 2.x tests | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' # Run at 8AM UTC. | |
push: | |
branches: | |
- '1.x' | |
- '1.x-**' | |
pull_request: | |
branches: | |
- '1.x' | |
jobs: | |
build: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- 3.8 | |
- 3.9 | |
- '3.10' | |
- 3.11 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Create docker-compose.yml | |
run: curl https://raw.githubusercontent.com/farmOS/farmOS/2.x/docker/docker-compose.development.yml -o docker-compose.yml | |
- name: Start containers | |
run: docker-compose up -d && sleep 5 | |
- name: Install farmOS | |
run: | | |
docker-compose exec -u www-data -T www drush site-install -y --db-url=pgsql://farm:farm@db/farm --account-pass=admin | |
docker-compose exec -u www-data -T www drush user-create tester --password test | |
docker-compose exec -u www-data -T www drush user-add-role farm_manager tester | |
docker-compose exec -u www-data -T www drush config:set simple_oauth.settings access_token_expiration 15 -y | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest -e .[test] | |
- name: Run farmOS.py tests. | |
run: pytest tests | |
env: | |
FARMOS_HOSTNAME: 'http://localhost' | |
FARMOS_OAUTH_USERNAME: 'tester' | |
FARMOS_OAUTH_PASSWORD: 'test' |