lamadava: Fallback to GQL if v2 fails #488
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: Test and Deploy | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * 5' # Fridays at 8am | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
name: Lint & Test | |
strategy: | |
matrix: | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
pip install -r requirements/local.txt | |
- name: Check makemigrations | |
run: | | |
python manage.py makemigrations --check --dry-run -v2 | |
- name: Lint code | |
run: | | |
make lint | |
- name: Run tests | |
run: | | |
make test | |
env: | |
EAS_PAYPAL_SECRET: ${{ secrets.EAS_PAYPAL_SECRET }} | |
EAS_DATALAMA_APIK: ${{ secrets.EAS_DATALAMA_APIK }} | |
- name: Check pip frozen reqs | |
run: | | |
make check-frozen-reqs | |
set-vars: | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
outputs: | |
deployment_branch: '${{steps.set_vars.outputs.deployment_branch}}' | |
steps: | |
- name: Set vars | |
id: set_vars | |
run: | | |
echo "deployment_branch=" >> $GITHUB_OUTPUT | |
if [[ "${{github.ref}}" == "refs/heads/master" ]]; then | |
# if this is a push to master, deploy to dev | |
if [[ "${{github.event_name}}" == "push" ]]; then | |
echo "deployment_branch=master" >> $GITHUB_OUTPUT | |
# If triggered manually, deply to prod | |
elif [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then | |
echo "deployment_branch=prod" >> $GITHUB_OUTPUT | |
fi | |
fi | |
test_swagger_editor_validator_remote: | |
runs-on: ubuntu-latest | |
name: Validate swagger file | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate OpenAPI definition | |
uses: char0n/swagger-editor-validate@v1 | |
with: | |
definition-file: swagger.yaml | |
deploy: | |
if: needs.set-vars.outputs.deployment_branch != '' | |
runs-on: ubuntu-latest | |
needs: | |
- run-tests | |
- set-vars | |
steps: | |
- name: Invoke deployment workflow | |
uses: benc-uk/workflow-dispatch@4c044c1613fabbe5250deadc65452d54c4ad4fc7 | |
with: | |
workflow: Manually triggered workflow for deployment | |
repo: etcaterva/deployment | |
token: ${{ secrets.AUTOMATION_TOKEN }} | |
inputs: '{ "tags": "cd-backend" }' | |
ref: 'refs/heads/${{ needs.set-vars.outputs.deployment_branch }}' | |
- name: Deployment URL | |
id: set_vars | |
run: | | |
echo "Follow deployment jobs for this branch:" | |
echo "- https://github.com/etcaterva/deployment/actions?query=workflow%3A%22Manually+triggered+workflow+for+deployment%22+branch%3A${{ needs.set-vars.outputs.deployment_branch }}" |