Skip to content

Commit

Permalink
build: Be more explicit about which services we're using.
Browse files Browse the repository at this point in the history
- Use mongo via a github service.
- Setup python using `setup-python` instead of assuming the system is
  right.
  • Loading branch information
feanil committed Jan 19, 2024
1 parent a3d228b commit 5a7c532
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/migrations-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
python-version: [ 3.8 ]
# 'pinned' is used to install the latest patch version of Django
# within the global constraint i.e. Django==3.2.21 in current case
# because we have global constraint of Django<4.2
# because we have global constraint of Django<4.2
django-version: ["pinned", "4.2"]
mongo-version: ["4"]
mysql-version: ["5.7", "8"]
# excluding mysql5.7 with Django 4.2 since Django 4.2 has
# excluding mysql5.7 with Django 4.2 since Django 4.2 has
# dropped support for MySQL<8
exclude:
- django-version: "4.2"
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
./manage.py lms migrate
echo "Running the CMS migrations."
./manage.py cms migrate
# This job aggregates test results. It's the required check for branch protection.
# https://github.com/marketplace/actions/alls-green#why
# https://github.com/orgs/community/discussions/33579
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
django-version:
- "pinned"
- "4.2"
mongo-version: ["4"]
# When updating the shards, remember to make the same changes in
# .github/workflows/unit-tests-gh-hosted.yml
shard_name:
Expand All @@ -39,20 +40,30 @@ jobs:
- "xmodule-with-cms"
# We expect Django 4.0 to fail, so don't stop when it fails.
continue-on-error: ${{ matrix.django-version == '4.0' }}

services:
mongo:
image: mongo:${{ matrix.mongo-version }}
ports:
- 27017:27017
# Note: Calling mongo here only works with mongo 4, in newer versions of mongo
# we'll have to use `mongosh`
options: >-
--health-cmd "mongo --quiet --eval 'db.runCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 3
steps:
- name: sync directory owner
run: sudo chown runner:runner -R .*

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: checkout repo
uses: actions/checkout@v3

- name: start mongod server for tests
run: |
sudo mkdir -p /data/db
sudo chmod -R a+rw /data/db
mongod &
- name: install requirements
run: |
sudo make test-requirements
Expand Down

0 comments on commit 5a7c532

Please sign in to comment.