diff --git a/.github/workflows/backend/python.yml b/.github/workflows/backend/python.yml new file mode 100644 index 0000000..c6275f1 --- /dev/null +++ b/.github/workflows/backend/python.yml @@ -0,0 +1,46 @@ +name: Build Python and Django + +on: + workflow_call: + inputs: + python_version: + description: 'Python version' + type: string + default: '3.10' + secrets: + django_secret: + required: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ inputs.python_verison }} + uses: actions/setup-python@v3 + with: + python-version: ${{ inputs.python_version }} + + - name: Install pipenv + run: | + python -m pip install --upgrade pipenv wheel + + - id: cache-pipenv + uses: actions/cache@v1 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + + - name: Install dependencies + if: steps.cache-pipenv.outputs.cache-hit != 'true' + run: | + pipenv install --deploy --dev + + - name: Makes sure it runs + env: + SECRET_KEY: ${{ secrets.django_secret }} + run: | + pipenv run python manage.py check + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7d2551e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +name: Build Pipeline + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + python: + uses: backend/python.yml + secrets: + django_secret: ${{ secrets.DJANGO_SECRET }} + diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml deleted file mode 100644 index f2c0f2a..0000000 --- a/.github/workflows/django.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Django CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v3 - - 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 -r requirements.txt - - name: Run Tests - run: | - python manage.py test