Skip to content

Commit

Permalink
Merge pull request #684 from comses/vite-bookworm
Browse files Browse the repository at this point in the history
build(deps): upgrade to debian bookworm node-lts
  • Loading branch information
alee authored Jan 5, 2024
2 parents 020534e + a50e653 commit 82c5763
Show file tree
Hide file tree
Showing 16 changed files with 7,525 additions and 4,546 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.git
.yarn/cache
.yarn/install-state.gz
build
incoming
docker
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/frontend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up docker buildx
uses: docker/setup-buildx-action@v2
- name: build container
run: |
make docker-compose.yml
docker compose build vite --pull
docker compose build vite --pull --no-cache
docker compose up vite -d
- name: Lint
run: docker compose exec vite yarn lint
run: docker compose exec vite npm run lint
- name: Check formatting
if: ${{ success() || failure() }}
run: docker compose exec vite yarn style
run: docker compose exec vite npm run style
- name: Unit tests
if: ${{ success() || failure() }}
run: docker compose exec vite yarn test
run: docker compose exec vite npm run test
- name: Type check
if: ${{ success() || failure() }}
run: docker compose exec vite yarn type-check
run: docker compose exec vite npm run type-check
- name: Build for production
if: ${{ success() || failure() }}
run: docker compose exec vite npm run build
- name: bring down container
if: ${{ always() }}
run: docker compose down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ test: build
e2e: DEPLOY_ENVIRONMENT=e2e
e2e: build
docker compose run server inv collectstatic
docker compose run --rm e2e yarn test
docker compose run --rm e2e npm run test
docker compose down
21 changes: 11 additions & 10 deletions django/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bagit==1.8.1
bleach==6.0.0
bleach==6.1.0
dedupe==2.0.23
django-allauth==0.58.2
django-anymail[mailgun]==10.2
Expand All @@ -8,18 +8,19 @@ django-csp[jinja2]==3.7
django-extensions==3.2.3
django-guardian==2.4.0
django-hcaptcha-field==1.4.0
django-ipware==5.0.2
django-location-field==2.7.2
django-ipware==6.0.3
django-location-field==2.7.3
django-markupfield==2.0.1
django-modelcluster>=6.2.0
django-model-utils==4.3.1
django-redis==5.4.0
django-rest-auth==0.9.5
django-rest-swagger==2.2.0
django-reversion==5.0.8
django-reversion==5.0.10
django-robots==6.1
django-timezone-field==6.0.1
django-vite==2.1.3
django-waffle==4.0.0
django-timezone-field==6.1.0
django-vite==2.1.3 # latest is 3.0.1
django-waffle==4.1.0
djangorestframework==3.14.0
djangorestframework-camel-case==1.4.2
Django==4.2.7
Expand All @@ -36,13 +37,13 @@ psycopg2-binary==2.9.9
pytz==2023.3
redis==4.5.5
requests==2.31.0
semver==3.0.1
sentry-sdk==1.35.0
semver==3.0.2
sentry-sdk==1.39.1
shortuuid==1.0.11
tzdata==2023.3
uwsgi==2.0.23
uwsgitop==0.11
wagtail==5.2
wagtail==5.2.2
# used for institution -> affiliation data migration, unused afterwards
fuzzywuzzy==0.18.0
invoke
Expand Down
39 changes: 18 additions & 21 deletions django/search/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def setUp(self):
self.query1 = Query.get("acorns")
self.query2 = Query.get("chestnuts")

today = datetime.date.today()
self.date1 = today - datetime.timedelta(days=10)
self.date2 = today - datetime.timedelta(days=5)
self.year = 2023
self.date1 = datetime.date(self.year, 1, 1)
self.date2 = datetime.date(self.year, 1, 10)

for _ in range(Q1_D1_HITS):
self.query1.add_hit(self.date1)
Expand All @@ -34,13 +34,13 @@ def test_archive_from_daily_hits_create(self):
ArchivedQueryHits.archive_from_daily_hits()

archived_hits_query1 = ArchivedQueryHits.objects.get(
query_string=self.query1.query_string
query_string=self.query1.query_string, year=self.year
)
self.assertEqual(archived_hits_query1.hits, Q1_HITS)
self.assertEqual(archived_hits_query1.last_updated, self.date2)

archived_hits_query2 = ArchivedQueryHits.objects.get(
query_string=self.query2.query_string
query_string=self.query2.query_string, year=self.year
)
self.assertEqual(archived_hits_query2.hits, Q2_HITS)
self.assertEqual(archived_hits_query2.last_updated, self.date2)
Expand All @@ -51,33 +51,30 @@ def test_archive_from_daily_hits_no_double_counting(self):

# hits from date2 should not be counted twice
archived_hits_query1 = ArchivedQueryHits.objects.get(
query_string=self.query1.query_string
query_string=self.query1.query_string, year=self.year
)
self.assertEqual(archived_hits_query1.hits, Q1_HITS)

archived_hits_query2 = ArchivedQueryHits.objects.get(
query_string=self.query2.query_string
query_string=self.query2.query_string, year=self.year
)
self.assertEqual(archived_hits_query2.hits, Q2_HITS)

def test_archive_from_daily_hits_update(self):
today = datetime.date.today()

for _ in range(10):
self.query1.add_hit(today)
for _ in range(5):
self.query2.add_hit(today)
ArchivedQueryHits.archive_from_daily_hits()

updated_date = datetime.date(2024, 1, 1)
self.query1.add_hit(updated_date)
ArchivedQueryHits.archive_from_daily_hits()

archived_hits_query1 = ArchivedQueryHits.objects.get(
query_string=self.query1.query_string
archived_hits_year1 = ArchivedQueryHits.objects.get(
query_string=self.query1.query_string, year=self.year
)
self.assertEqual(archived_hits_query1.hits, Q1_HITS + 10)
self.assertEqual(archived_hits_query1.last_updated, today)
self.assertEqual(archived_hits_year1.hits, Q1_HITS)
self.assertEqual(archived_hits_year1.last_updated, self.date2)

archived_hits_query2 = ArchivedQueryHits.objects.get(
query_string=self.query2.query_string
archived_hits_year2 = ArchivedQueryHits.objects.get(
query_string=self.query1.query_string, year=updated_date.year
)
self.assertEqual(archived_hits_query2.hits, Q2_HITS + 5)
self.assertEqual(archived_hits_query2.last_updated, today)
self.assertEqual(archived_hits_year2.hits, 1)
self.assertEqual(archived_hits_year2.last_updated, updated_date)
2 changes: 1 addition & 1 deletion e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
vite:
volumes:
- ./frontend:/code
command: ["yarn", "build"]
command: ["npm", "run", "build"]
environment:
NODE_ENV: "e2e"
server:
Expand Down
8 changes: 4 additions & 4 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM cypress/base:18.14.1
WORKDIR /code

# only install dependencies if package.json or yarn.lock has changed
# only install dependencies if package.json or package-lock.json has changed
COPY package.json .
COPY yarn.lock .
COPY package-lock.json .

# suppress most of the cypress messages
ENV CI=1

RUN yarn install --frozen-lockfile
RUN npm install

# verify that cypress is installed correctly
RUN yarn cypress verify
RUN npm run cy:run -- verify
Loading

0 comments on commit 82c5763

Please sign in to comment.