|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Triggers: when this workflow runs |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main # run on pushes to main |
| 8 | + - test # run on pushes to test |
| 9 | + tags: |
| 10 | + - "*" # run on any tag push (useful for releases) |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - main # run on PRs targeting main |
| 14 | + workflow_dispatch: # allow manual runs from the Actions tab |
| 15 | + |
| 16 | +# Cancel in-progress runs when a new commit is pushed to the same ref. |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +# Start with zero permissions; grant per-job what's actually needed. |
| 22 | +permissions: {} |
| 23 | + |
| 24 | +env: |
| 25 | + PYTHON_VERSION: '3.12' |
| 26 | + |
| 27 | +jobs: |
| 28 | + check: |
| 29 | + name: Check if the plugin can be used with RDMO |
| 30 | + runs-on: ubuntu-slim |
| 31 | + steps: |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@v5 |
| 34 | + with: |
| 35 | + python-version: ${{ env.PYTHON_VERSION }} |
| 36 | + cache: 'pip' |
| 37 | + cache-dependency-path: | |
| 38 | + rdmo/pyproject.toml |
| 39 | + ${{ github.event.repository.name }}/pyproject.toml |
| 40 | +
|
| 41 | + - name: Checkout rdmo |
| 42 | + uses: actions/checkout@v6 |
| 43 | + with: |
| 44 | + repository: rdmorganiser/rdmo |
| 45 | + path: rdmo |
| 46 | + persist-credentials: false |
| 47 | + |
| 48 | + - name: Checkout rdmo-app |
| 49 | + uses: actions/checkout@v6 |
| 50 | + with: |
| 51 | + repository: rdmorganiser/rdmo-app |
| 52 | + path: rdmo-app |
| 53 | + persist-credentials: false |
| 54 | + |
| 55 | + - name: Checkout this repo |
| 56 | + uses: actions/checkout@v6 |
| 57 | + with: |
| 58 | + path: ${{ github.event.repository.name }} |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + - name: Configure rdmo-app settings |
| 62 | + working-directory: rdmo-app |
| 63 | + run: | |
| 64 | + cat >> config/settings/local.py <<'EOF' |
| 65 | + DEBUG = True |
| 66 | + ALLOWED_HOSTS = ['localhost'] |
| 67 | + SECRET_KEY = 'not a very secret key' |
| 68 | + EOF |
| 69 | +
|
| 70 | + - name: Install rdmo |
| 71 | + run: pip install -e 'rdmo' |
| 72 | + |
| 73 | + - name: Install plugin |
| 74 | + run: pip install -e './${{ github.event.repository.name }}' |
| 75 | + |
| 76 | + - name: Run migrations |
| 77 | + working-directory: rdmo-app |
| 78 | + run: ./manage.py migrate |
| 79 | + |
| 80 | + - name: Create superuser |
| 81 | + working-directory: rdmo-app |
| 82 | + env: |
| 83 | + DJANGO_SUPERUSER_PASSWORD: admin |
| 84 | + run: ./manage.py createsuperuser --noinput --username admin --email admin@example.com |
| 85 | + |
| 86 | + - name: Run Django system checks |
| 87 | + working-directory: rdmo-app |
| 88 | + run: ./manage.py check |
0 commit comments