Skip to content

Commit 8c0f26e

Browse files
Merge branch 'main' into ans_oah_tests
2 parents a95507c + 522f4f8 commit 8c0f26e

643 files changed

Lines changed: 3941 additions & 10446 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@
2626
!yarn.lock
2727

2828
# ...but DO ignore these others
29-
cfgov/apache
3029
cfgov/f
3130
cfgov/static_built

.env_SAMPLE

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,20 @@ export DJANGO_ADMIN_PASSWORD=admin
2020

2121
######################################################
2222
# Wagtail-Sharing - for sharing unpublished drafts.
23-
#
24-
# Used in initial_data script to set sharing hostname.
2523
# See https://github.com/cfpb/wagtail-sharing.
2624
#####################################################
27-
export WAGTAIL_SHARING_HOSTNAME=content.localhost
25+
export WAGTAILSHARING_HOST=content.localhost:8000
2826

2927
########################################
3028
# Application feature related variables.
3129
########################################
3230

33-
# Location used by refresh_data.sh for retrieving latest database dump.
34-
#export CFGOV_PROD_DB_LOCATION=<some_database_dump_url>
35-
3631
#export ENABLE_DEFAULT_CACHE=1
3732
#export EMAIL_HOST=<email_server_hostname>
3833
#export ADMIN_EMAILS=<comma_delimited_list_of_emails>
3934
#export WAGTAILADMIN_NOTIFICATION_FROM_EMAIL=<wagtail_notification_from_email>
4035
#export LOGIN_FAIL_TIME_PERIOD=<time_between_failed_attempts>
4136
#export LOGIN_FAILS_ALLOWED=<number_of_fails_allowed_before_lockout>
42-
export ALLOW_ADMIN_URL=True
4337
#export ENABLE_AKAMAI_CACHE_PURGE=True
4438
#export AKAMAI_OBJECT_ID=<akamai_object_id>
4539
#export AKAMAI_ACCESS_TOKEN=<akamai_access_token>
@@ -49,9 +43,9 @@ export ALLOW_ADMIN_URL=True
4943
#export AKAMAI_PURGE_ALL_URL=<akamai_purge_all_url>
5044
#export AKAMAI_PURGE_HOSTNAMES=<akamai_purge_hostnames>
5145

52-
# export ENABLE_CLOUDFRONT_CACHE_PURGE=True
53-
# export CLOUDFRONT_DISTRIBUTION_ID_FILES=<cloudfront_distribution_id_files_cf_gov>
54-
# export CLOUDFRONT_PURGE_HOSTNAMES=<cloudfront_purge_hostnames>
46+
# export ENABLE_FILES_CACHE_PURGE=True
47+
# export AKAMAI_FILES_OBJECT_ID=<akamai_files_object_id>
48+
# export AKAMAI_FILES_PURGE_HOSTNAMES=<files_purge_hostnames>
5549

5650
#####################################################################
5751
# Override Django database URL.

.github/workflows/apache.yml

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

.github/workflows/backend.yml

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ on:
44
workflow_dispatch:
55
pull_request:
66
paths:
7-
- '**.py'
8-
- 'requirements/**.txt'
9-
- '**.html'
10-
- '**.mo'
11-
- '**.po'
7+
- "**.py"
8+
- "requirements/**.txt"
9+
- "**.html"
10+
- "**.mo"
11+
- "**.po"
1212
merge_group:
13+
push:
14+
branches:
15+
- main
1316

1417
jobs:
1518
backend:
1619
runs-on: ubuntu-latest
1720

18-
env:
19-
# LD_LIBRARY_PATH is set so that validate-translations can find gettext.
20-
LD_LIBRARY_PATH: /usr/local/lib
21-
2221
strategy:
2322
matrix:
2423
toxenv:
@@ -32,46 +31,63 @@ jobs:
3231
postgres:
3332
# https://help.github.com/en/actions/configuring-and-managing-workflows/creating-postgresql-service-containers
3433
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
35-
image: postgres:13
34+
image: postgres:17
3635
env:
3736
POSTGRES_USER: cfpb
3837
POSTGRES_PASSWORD: cfpb
3938
POSTGRES_DB: cfgov
4039
ports:
41-
- 5432:5432
40+
- 5432:5432
4241
# needed because the postgres container does not provide a healthcheck
4342
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
4443

4544
elasticsearch:
4645
image: elasticsearch:7.10.1
4746
ports:
48-
- 9200/tcp
47+
- 9200/tcp
4948
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
5049

5150
steps:
5251
- uses: actions/checkout@v4
5352

53+
- name: Check cache for gettext
54+
id: cache-gettext
55+
if: matrix.toxenv == 'validate-translations'
56+
uses: actions/cache@v4
57+
with:
58+
path: ${{ github.workspace }}/gettext-install
59+
key: ${{ runner.os }}-gettext-0.25
60+
5461
- name: Install gettext for translations
5562
if: matrix.toxenv == 'validate-translations'
63+
run: |
64+
if [ "${{ steps.cache-gettext.outputs.cache-hit }}" != "true" ]; then
65+
curl -LO https://ftp.gnu.org/pub/gnu/gettext/gettext-0.25.tar.gz
66+
tar xzvf gettext-0.25.tar.gz
67+
cd gettext-0.25
68+
./configure --prefix=${{ github.workspace }}/gettext-install
69+
make -j$(nproc)
70+
make install
71+
fi
72+
73+
# Always add gettext to path, whether built or restored from cache.
74+
echo "${{ github.workspace }}/gettext-install/bin" >> $GITHUB_PATH
75+
echo "LD_LIBRARY_PATH=${{ github.workspace }}/gettext-install/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
76+
77+
- name: Install lxml dependencies
5678
run: |
5779
sudo apt-get update
58-
sudo apt-get install -y build-essential
59-
curl -LO https://ftp.gnu.org/pub/gnu/gettext/gettext-0.25.tar.gz
60-
tar xzvf gettext-0.25.tar.gz
61-
cd gettext-0.25
62-
./configure --prefix=/usr/local
63-
make -j$(nproc)
64-
sudo make install
80+
sudo apt-get install python3.12-dev libxml2-dev libxslt-dev
6581
6682
- name: Set up Python
6783
uses: actions/setup-python@v5
6884
with:
69-
python-version: 3.8
85+
python-version: 3.13
7086

7187
- name: Set up Node
7288
uses: actions/setup-node@v4
7389
with:
74-
node-version: '24.x'
90+
node-version: "24.x"
7591

7692
- name: Install dependencies
7793
run: |
@@ -105,12 +121,12 @@ jobs:
105121
steps:
106122
- uses: actions/checkout@v4
107123
with:
108-
fetch-depth: 0
124+
fetch-depth: 2
109125

110126
- name: Set up Python
111127
uses: actions/setup-python@v5
112128
with:
113-
python-version: 3.8
129+
python-version: 3.13
114130

115131
- name: Install dependencies
116132
run: |
@@ -125,4 +141,11 @@ jobs:
125141

126142
- name: Check backend test coverage
127143
run: |
128-
diff-cover backend_coverage/coverage.xml --compare-branch=origin/main --fail-under=100
144+
if [ "${{ github.event_name }}" == "pull_request" ]; then
145+
git fetch origin main
146+
COMPARE_FLAG="--compare-branch=origin/main"
147+
else
148+
git diff HEAD~1 HEAD > diff.txt
149+
COMPARE_FLAG="--diff-file=diff.txt"
150+
fi
151+
diff-cover backend_coverage/coverage.xml $COMPARE_FLAG --fail-under=100

.github/workflows/build-artifact.yml

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

.github/workflows/build-docker.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,68 @@ name: Build cf.gov Docker images
22

33
on:
44
pull_request:
5+
push:
6+
branches:
7+
- main
58
merge_group:
69
workflow_dispatch:
710

811
jobs:
912
build-docker-images:
1013
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
1117

1218
steps:
1319
- name: Checkout code
1420
uses: actions/checkout@v4
1521

22+
- name: Extract metadata
23+
id: meta
24+
run: |
25+
SHORT_SHA=$(git rev-parse --short HEAD)
26+
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
27+
28+
ORG_LOWER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
29+
echo "org_lower=$ORG_LOWER" >> $GITHUB_OUTPUT
30+
31+
- name: Determine if we should push to GHCR
32+
id: should_push
33+
run: |
34+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
35+
echo "result=true" >> $GITHUB_OUTPUT
36+
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
37+
echo "result=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "result=false" >> $GITHUB_OUTPUT
40+
fi
41+
1642
- name: Build cfgov image
17-
run: docker build -t cfgov:latest .
43+
run: docker build -t cfgov:local .
44+
45+
- name: Log in to GHCR
46+
if: steps.should_push.outputs.result == 'true'
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Push to GHCR on pushes to main
54+
if: github.ref == 'refs/heads/main' && steps.should_push.outputs.result == 'true'
55+
run: |
56+
IMAGE_NAME="ghcr.io/${{ steps.meta.outputs.org_lower }}/cfgov/cfgov"
57+
docker tag cfgov:local $IMAGE_NAME:latest
58+
docker tag cfgov:local $IMAGE_NAME:sha-${{ steps.meta.outputs.short_sha }}
59+
docker push $IMAGE_NAME:latest
60+
docker push $IMAGE_NAME:sha-${{ steps.meta.outputs.short_sha }}
1861
19-
- name: Build cfgov-apache image
20-
run: docker build -t cfgov-apache:latest cfgov/apache
62+
- name: Push on PRs
63+
if: github.event_name == 'pull_request' && steps.should_push.outputs.result == 'true'
64+
run: |
65+
IMAGE_NAME="ghcr.io/${{ steps.meta.outputs.org_lower }}/cfgov/cfgov"
66+
docker tag cfgov:local $IMAGE_NAME:pr-${{ github.event.pull_request.number }}
67+
docker tag cfgov:local $IMAGE_NAME:pr-${{ github.event.pull_request.number }}-${{ steps.meta.outputs.short_sha }}
68+
docker push $IMAGE_NAME:pr-${{ github.event.pull_request.number }}
69+
docker push $IMAGE_NAME:pr-${{ github.event.pull_request.number }}-${{ steps.meta.outputs.short_sha }}

0 commit comments

Comments
 (0)