mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Add migration test workflow (#4973)
* Add migration test workflow * Adds dummy migration - For testing only - Will be removed * Improvements to workflow * Update workflow * Use manual git step * Don't install twice * Let's try again * Does v3 work? * Try https repo * Fix repo address * Once more with feeling * Fix location of test database * Revert change to wrong file * Fix DB location * Hard-code database path * debugging * More updates grrr * Adjust permissions on database file * Manual git operation * Updates for migration test workflow * Fix database names * Remove dummy migration file * Fix filters * Fix path filter * Explicit pathing * Fix formatting error * Another formatting error
This commit is contained in:
parent
e2800b19ef
commit
66ec82d4d1
2
.github/actions/migration/action.yaml
vendored
2
.github/actions/migration/action.yaml
vendored
@ -1,5 +1,5 @@
|
|||||||
name: 'Migration test'
|
name: 'Migration test'
|
||||||
description: 'Run migration test sequenze'
|
description: 'Run migration test sequence'
|
||||||
author: 'InvenTree'
|
author: 'InvenTree'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
|
80
.github/workflows/migration_test.yaml
vendored
Normal file
80
.github/workflows/migration_test.yaml
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
# This workflow ensures that any database migrations apply cleanly to a "production" database
|
||||||
|
# On a PR to master, the workflow will run against a "sample" production database,
|
||||||
|
# which is sitting at the current "master" migration level
|
||||||
|
# On a push to master, the workflow will also commit any migrations to the "production" database
|
||||||
|
|
||||||
|
name: Migration Testing
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
python_version: 3.9
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
INVENTREE_DB_ENGINE: sqlite3
|
||||||
|
INVENTREE_DB_NAME: /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
INVENTREE_MEDIA_ROOT: ../test_inventree_media
|
||||||
|
INVENTREE_STATIC_ROOT: ../test_inventree_static
|
||||||
|
INVENTREE_BACKUP_DIR: ../test_inventree_backup
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
paths-filter:
|
||||||
|
name: Filter
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
server: ${{ steps.filter.outputs.server }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3.1.0
|
||||||
|
- uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
server:
|
||||||
|
- 'InvenTree/**'
|
||||||
|
- 'requirements.txt'
|
||||||
|
- 'requirements-dev.txt'
|
||||||
|
- '.github/**'
|
||||||
|
|
||||||
|
migrations-checks:
|
||||||
|
name: Run Database Migrations
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: paths-filter
|
||||||
|
if: needs.paths-filter.outputs.server == 'true'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
name: Checkout Code
|
||||||
|
- name: Environment Setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
- name: Fetch Database
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 https://github.com/inventree/test-db ./test-db
|
||||||
|
|
||||||
|
- name: Latest Database
|
||||||
|
run: |
|
||||||
|
cp test-db/latest.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
invoke migrate
|
||||||
|
|
||||||
|
- name: 0.10.0 Database
|
||||||
|
run: |
|
||||||
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
cp test-db/stable_0.10.0.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
invoke migrate
|
||||||
|
|
||||||
|
- name: 0.11.0 Database
|
||||||
|
run: |
|
||||||
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
cp test-db/stable_0.11.0.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
invoke migrate
|
Loading…
x
Reference in New Issue
Block a user