Skip to content

Commit ff8b2f6

Browse files
committed
Merge branch 'release/1.18.1'
2 parents cea6331 + fe1bac3 commit ff8b2f6

20 files changed

Lines changed: 541 additions & 200 deletions

File tree

.github/ISSUE_TEMPLATE/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ git commit -m "X.Y.Z"
2323
$ git flow release publish X.Y.Z
2424
```
2525
- [ ] Test the release branch on staging
26-
- [ ] Start a new [release pipeline job](http://urbanappsci.internal.azavea.com/job/DistrictBuilder%20Release%20Pipeline/build?delay=0sec) with the SHA (see command below) of `release/X.Y.Z` that was tested on staging
26+
- [ ] Start a new [release workflow](https://github.com/PublicMapping/districtbuilder/actions/workflows/release.yml) with the SHA (see command below) of `release/X.Y.Z` that was tested on staging
2727
```bash
2828
$ git rev-parse --short HEAD
2929
```

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Github CI
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- test/**
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: build
14+
runs-on: ubuntu-latest
15+
env:
16+
DOCKER_BUILDKIT: 1
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: CI Build
21+
run: ./scripts/cibuild
22+
env:
23+
NODE_ENV: test
24+
25+
- uses: aws-actions/configure-aws-credentials@v1
26+
with:
27+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29+
aws-region: "us-east-1"
30+
31+
- name: CI Publish
32+
run: |
33+
unset AWS_PROFILE
34+
./scripts/cipublish
35+
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/test/')
36+
37+
- name: Infra Plan and Apply
38+
run: |
39+
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run --rm terraform -c "
40+
unset AWS_PROFILE
41+
./scripts/infra plan
42+
./scripts/infra apply"
43+
env:
44+
DB_ROLLBAR_ACCESS_TOKEN: ${{ secrets.DB_ROLLBAR_ACCESS_TOKEN }}
45+
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/test/')

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
git_commit:
7+
description: 'Short Git commit hash to deploy to production'
8+
required: true
9+
10+
jobs:
11+
release:
12+
name: release
13+
runs-on: ubuntu-latest
14+
env:
15+
DOCKER_BUILDKIT: 1
16+
GIT_COMMIT: ${{ github.event.inputs.git_commit }}
17+
DB_SETTINGS_BUCKET: districtbuilder-production-config-us-east-1
18+
DB_DEPLOYMENT_ENVIRONMENT: "production"
19+
NODE_ENV: production
20+
DB_ROLLBAR_ACCESS_TOKEN: ${{ secrets.DB_ROLLBAR_ACCESS_TOKEN }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- uses: aws-actions/configure-aws-credentials@v1
25+
with:
26+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
27+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
28+
aws-region: "us-east-1"
29+
30+
- name: Slack Notification
31+
uses: rtCamp/action-slack-notify@v2
32+
env:
33+
SLACK_CHANNEL: district-builder
34+
SLACK_MESSAGE: 'deploying revision https://github.com/publicmapping/districtbuilder/tree/${{ github.event.inputs.git_commit }} to *production*'
35+
SLACK_TITLE: Deploying
36+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
37+
38+
- run: |
39+
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run --rm terraform -c "
40+
unset AWS_PROFILE
41+
./scripts/infra plan
42+
./scripts/infra apply"
43+
44+
- name: Slack Notification
45+
uses: rtCamp/action-slack-notify@v2
46+
env:
47+
SLACK_CHANNEL: district-builder
48+
SLACK_MESSAGE: 'deployed revision https://github.com/publicmapping/districtbuilder/tree/${{ github.event.inputs.git_commit }} to *production*'
49+
SLACK_TITLE: Deployed
50+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515

16+
## [1.18.1]
17+
18+
### Added
19+
- Added API spec for `/api/globalProjects` [#1239](https://github.com/PublicMapping/districtbuilder/pull/1239)
20+
21+
### Changed
22+
- Ported from Jenkins to Github actions including cibuild and staging deploy [#1245](https://github.com/PublicMapping/districtbuilder/pull/1245)
23+
- Added Github Release workflow [#1255](https://github.com/PublicMapping/districtbuilder/pull/1255)
24+
25+
### Fixed
26+
- Fixed server crashed caused by archived maps w/ an archived region [#1244](https://github.com/PublicMapping/districtbuilder/pull/1244)
27+
1628
## [1.18.0]
1729
### Added
1830
- Added email opt-in on the registration page [#1210](https://github.com/PublicMapping/districtbuilder/pull/1210)
@@ -524,7 +536,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
524536

525537
- Initial release.
526538

527-
[unreleased]: https://github.com/publicmapping/districtbuilder/compare/1.18.0...HEAD
539+
[unreleased]: https://github.com/publicmapping/districtbuilder/compare/1.18.1...HEAD
540+
[1.18.1]: https://github.com/publicmapping/districtbuilder/compare/1.18.0...1.18.1
528541
[1.18.0]: https://github.com/publicmapping/districtbuilder/compare/1.17.3...1.18.0
529542
[1.17.3]: https://github.com/publicmapping/districtbuilder/compare/1.17.2...1.17.3
530543
[1.17.2]: https://github.com/publicmapping/districtbuilder/compare/1.17.1...1.17.2

Jenkinsfile

Lines changed: 0 additions & 85 deletions
This file was deleted.

doc/spec/README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# API Spec
2+
3+
## List global projects
4+
5+
Get a paginated list of global projects.
6+
7+
**URL** : `/api/globalProjects`
8+
9+
**Method** : `GET`
10+
11+
**Auth required** : NO
12+
13+
**Permissions required** : N/A
14+
15+
**Query Parameters** :
16+
- `page`: Integer; Page number; Default: `1`; Optional
17+
- `limit`: Integer; Number of global projects per page; Default: `10`; Optional
18+
- `completed`: Boolean; Filter to return completed projects or not; Default: `false`; Optional
19+
- `region`: String; Filter to the projects matching specified region code; Default: `undefined`; Optional
20+
21+
## Success Response
22+
23+
**Code** : `200 OK`
24+
25+
**Content examples**
26+
27+
**Note** the contents of the `voting` and `demographics` columns are dependent on the region the project is associated with. Not every region will have political data (some may have no data or only data for 2016) or the full range of demographic data available (though every region _will_ have `demographics.population` at the least).
28+
29+
```json
30+
{
31+
"items": [
32+
{
33+
"id": "UUID of a global project",
34+
"name": "Example project name",
35+
"numberOfDistricts": 10,
36+
"simplifiedDistricts": {
37+
"type": "FeatureCollection",
38+
"features": [
39+
{
40+
"id": 0,
41+
"type": "Feature",
42+
"geometry": {
43+
"type": "MultiPolygon",
44+
"coordinates": [...
45+
]
46+
},
47+
"properties": {
48+
"voting": {
49+
"democrat16": 0,
50+
"republican16": 0,
51+
"other party16": 0,
52+
"democrat20": 0,
53+
"republican20": 0,
54+
"other party20": 0
55+
},
56+
"contiguity": "",
57+
"compactness": 0,
58+
"demographics": {
59+
"VAP": 0,
60+
"CVAP": 0,
61+
"asian": 0,
62+
"black": 0,
63+
"white": 0,
64+
"native": 0,
65+
"pacific": 0,
66+
"hispanic": 0,
67+
"VAP Asian": 0,
68+
"VAP Black": 0,
69+
"VAP White": 0,
70+
"CVAP Asian": 0,
71+
"CVAP Black": 0,
72+
"CVAP White": 0,
73+
"VAP Native": 0,
74+
"population": 0,
75+
"CVAP Native": 0,
76+
"VAP Pacific": 0,
77+
"CVAP Pacific": 0,
78+
"VAP Hispanic": 0,
79+
"CVAP Hispanic": 0
80+
}
81+
}
82+
},
83+
...
84+
],
85+
"metadata": {
86+
"creator": {
87+
"id": "UUID of user",
88+
"name": "Example user name"
89+
},
90+
"completed": true,
91+
"regionConfig": {
92+
"id": "UUID of config",
93+
"name": "Example region config name",
94+
"s3URI": "s3://path/to/example/config/location",
95+
"regionCode": "Example region code",
96+
"countryCode": "Example country code"
97+
}
98+
}
99+
},
100+
"createdDt": "2022-06-24T00:00:00.000Z",
101+
"updatedDt": "2022-06-24T00:00:00.000Z",
102+
"submittedDt": null,
103+
"regionConfig": {
104+
"id": "UUID of config",
105+
"name": "Example region config name",
106+
"s3URI": "s3://path/to/example/config/location",
107+
"archived": false
108+
},
109+
"user": {
110+
"id": "UUID of user",
111+
"name": "Example user name"
112+
},
113+
"chamber": null
114+
},
115+
...
116+
],
117+
"meta": {
118+
"totalItems": 70,
119+
"itemCount": 8,
120+
"itemsPerPage": 8,
121+
"totalPages": 9,
122+
"currentPage": 1
123+
}
124+
}
125+
```

docker-compose.ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ services:
3030
environment:
3131
- AWS_PROFILE=${AWS_PROFILE:-district-builder}
3232
- GIT_COMMIT=${GIT_COMMIT}
33+
- GITHUB_SHA
34+
- AWS_ACCESS_KEY_ID
35+
- AWS_SECRET_ACCESS_KEY
3336
- DB_DEBUG=1
3437
- DB_SETTINGS_BUCKET=${DB_SETTINGS_BUCKET:-districtbuilder-staging-config-us-east-1}
3538
- DB_ROLLBAR_ACCESS_TOKEN

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
version: "2.4"
22
services:
33
database:
4-
image: quay.io/azavea/postgis:3-postgres12.4-slim
4+
image: postgis/postgis:13-3.1
55
environment:
66
- POSTGRES_USER=districtbuilder
77
- POSTGRES_PASSWORD=districtbuilder
88
- POSTGRES_DB=districtbuilder
99
healthcheck:
10-
test: pg_isready -U districtbuilder
10+
test: pg_isready -q -h database -U districtbuilder
1111
interval: 3s
1212
timeout: 3s
1313
retries: 3
14+
start_period: 5s
1415

1516
server:
1617
image: districtbuilder

scripts/cibuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
3131
-f docker-compose.ci.yml \
3232
build server manage
3333

34+
# Stop all docker containers so Github actions uses less memory
35+
docker stop districtbuilder_server_1 districtbuilder_database_1
36+
3437
CI=1 GIT_COMMIT="${GIT_COMMIT}" \
3538
./scripts/test
3639
fi

0 commit comments

Comments
 (0)