Repository navigation
75 lines (70 loc) · 2.45 KB
/
Copy pathdeploy.yml
File metadata and controls
75 lines (70 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Validate and deploy
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
inputs:
deploy:
description: Deploy this tested commit using the configured private Mac runner
type: boolean
default: false
permissions:
contents: read
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: 'backend/requirements*.txt'
- name: Install locked dependencies
run: python -m pip install -r backend/requirements-dev.txt
- name: Validate dependencies
run: python -m pip check
- name: Check Python errors
run: python -m flake8 backend --exclude=venv,venv311,.venv --select=E9,F63,F7,F82 --show-source
- name: Run required offline suite
working-directory: backend
run: python -m pytest --junitxml=test-results.xml
- uses: actions/upload-artifact@v4
if: always()
with:
name: backend-test-results
path: backend/test-results.xml
ios:
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Build and test in a disposable simulator
run: python3 scripts/test-ios.py
- uses: actions/upload-artifact@v4
if: always()
with:
name: ios-test-results
path: .test-artifacts/*.xcresult
deploy:
# Never deploy an untrusted pull request or automatically replace a local service.
# Configure the private runner + production environment before requesting rollout.
if: github.event_name == 'workflow_dispatch' && inputs.deploy && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
needs: [backend, ios]
runs-on: [self-hosted, macOS, peaceplayer-deploy]
environment: production
concurrency:
group: peaceplayer-production
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Deploy exactly the validated commit
env:
PEACEPLAYER_RELEASE_ROOT: ${{ vars.PEACEPLAYER_RELEASE_ROOT }}
PEACEPLAYER_SERVICE_LABEL: ${{ vars.PEACEPLAYER_SERVICE_LABEL }}
PEACEPLAYER_HEALTH_URL: ${{ vars.PEACEPLAYER_HEALTH_URL }}
TESTED_COMMIT: ${{ github.sha }}
run: python3.11 scripts/deploy-release.py "$TESTED_COMMIT"