-
Notifications
You must be signed in to change notification settings - Fork 13
162 lines (148 loc) · 4.65 KB
/
commit.yml
File metadata and controls
162 lines (148 loc) · 4.65 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: 1 - Commit
on: [push]
permissions:
contents: read
env:
PY_VERSION: "3.12"
POETRY_VERSION: "latest"
jobs:
lint:
runs-on: ubuntu-latest
name: Python Lint
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ env.PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
poetry-plugins: "poetry-plugin-export"
- name: Install Dependencies
run: |
poetry env use ${{ env.PY_VERSION }}
poetry install
- name: Run linting
run: make lint-check
test:
environment: development
env:
CF_SERVICE_USER: ${{secrets.CF_SERVICE_USER}}
CF_SERVICE_AUTH: ${{secrets.CF_SERVICE_AUTH}}
FLASK_APP_SECRET_KEY: ${{secrets.FLASK_APP_SECRET_KEY}}
runs-on: ubuntu-latest
name: Pytests
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ env.PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
poetry-plugins: "poetry-plugin-export"
- name: Install Dependencies
run: |
poetry env use ${{ env.PY_VERSION }}
poetry install
- name: Run Pytest
run: make test-ci
- name: Report test coverage
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true
with:
multiple-files: |
Unit tests, pytest-coverage-unit.txt, pytest-unit.xml
Integration Tests, pytest-coverage-integration.txt, pytest-integration.xml
Functional Tests, pytest-coverage-functional.txt, pytest-functional.xml
create-cloudgov-services-development:
if: github.ref == 'refs/heads/develop'
name: create services (development)
environment: development
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: create services
uses: cloud-gov/cg-cli-tools@main
with:
command: bash create_cloudgov_services.sh
cf_org: gsa-datagov
cf_space: development
cf_username: ${{secrets.CF_SERVICE_USER}}
cf_password: ${{secrets.CF_SERVICE_AUTH}}
deploy-development:
if: github.ref == 'refs/heads/develop'
name: deploy (development)
needs:
- create-cloudgov-services-development
environment: development
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install node.js
uses: actions/setup-node@v4
with:
node-version-file: "app/static/package.json"
- name: Build static assets
shell: bash
run: |
cd app/static
npm ci
npm run build
- name: Set up Python ${{ env.PY_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
poetry-plugins: "poetry-plugin-export"
- name: Add requirements.txt
run: |
poetry export -f requirements.txt --output requirements.txt --without-hashes
echo "Generated requirements.txt:"
cat requirements.txt
- name: Deploy admin app
uses: cloud-gov/cg-cli-tools@main
with:
command: cf push --vars-file vars.development.yml --strategy rolling --no-wait
cf_org: gsa-datagov
cf_space: development
cf_username: ${{secrets.CF_SERVICE_USER}}
cf_password: ${{secrets.CF_SERVICE_AUTH}}
network-policies:
name: Add network-policies
needs:
- deploy-development
runs-on: ubuntu-latest
environment: development
strategy:
fail-fast: false
matrix:
command:
[
"cf add-network-policy datagov-harvest mdtranslator --protocol tcp --port 8080",
]
environ: ["development"]
steps:
- name: proxy to web
uses: cloud-gov/cg-cli-tools@main
with:
command: ${{ matrix.command }}
cf_org: gsa-datagov
cf_space: ${{ matrix.environ }}
cf_username: ${{secrets.CF_SERVICE_USER}}
cf_password: ${{secrets.CF_SERVICE_AUTH}}