Add GitHub workflow #2
This file contains hidden or 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: CI | |
| # Triggers: when this workflow runs | |
| on: | |
| push: | |
| branches: | |
| - main # run on pushes to main | |
| - test # run on pushes to test | |
| tags: | |
| - "*" # run on any tag push (useful for releases) | |
| pull_request: | |
| branches: | |
| - main # run on PRs targeting main | |
| workflow_dispatch: # allow manual runs from the Actions tab | |
| # Cancel in-progress runs when a new commit is pushed to the same ref. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Start with zero permissions; grant per-job what's actually needed. | |
| permissions: {} | |
| env: | |
| PYTHON_VERSION: '3.12' | |
| jobs: | |
| check: | |
| name: Check if the plugin can be used with RDMO | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| rdmo/pyproject.toml | |
| ${{ github.event.repository.name }}/pyproject.toml | |
| - name: Checkout rdmo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: rdmorganiser/rdmo | |
| path: rdmo | |
| persist-credentials: false | |
| - name: Checkout rdmo-app | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: rdmorganiser/rdmo-app | |
| path: rdmo-app | |
| persist-credentials: false | |
| - name: Checkout this repo | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{ github.event.repository.name }} | |
| persist-credentials: false | |
| - name: Configure rdmo-app settings | |
| working-directory: rdmo-app | |
| run: | | |
| cat >> config/settings/local.py <<'EOF' | |
| DEBUG = True | |
| ALLOWED_HOSTS = ['localhost'] | |
| SECRET_KEY = 'not a very secret key' | |
| EOF | |
| - name: Install rdmo | |
| run: pip install -e 'rdmo' | |
| - name: Install plugin | |
| run: pip install -e './${{ github.event.repository.name }}' | |
| - name: Run migrations | |
| working-directory: rdmo-app | |
| run: ./manage.py migrate | |
| - name: Create superuser | |
| working-directory: rdmo-app | |
| env: | |
| DJANGO_SUPERUSER_PASSWORD: admin | |
| run: ./manage.py createsuperuser --noinput --username admin --email admin@example.com | |
| - name: Run Django system checks | |
| working-directory: rdmo-app | |
| run: ./manage.py check |