Skip to content

Commit

Permalink
minimize
Browse files Browse the repository at this point in the history
  • Loading branch information
cweider committed Oct 22, 2024
1 parent ca318b7 commit ea9a150
Showing 1 changed file with 11 additions and 72 deletions.
83 changes: 11 additions & 72 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ jobs:
matrix:
tag_flags: ["--exclude-tag selenium"]
steps:
- name: Check out solr
uses: actions/checkout@v4
with:
repository: freelawproject/courtlistener-solr-server
ref: main
path: courtlistener-solr-server
- name: Set up solr permissions
run: |
cd courtlistener-solr-server
sudo chown -R :1024 data
sudo chown -R :1024 solr
sudo find data -type d -exec chmod g+s {} \;
sudo find solr -type d -exec chmod g+s {} \;
sudo find data -type d -exec chmod 775 {} \;
sudo find solr -type d -exec chmod 775 {} \;
sudo find data -type d -exec chmod 664 {} \;
sudo find solr -type f -exec chmod 664 {} \;
- name: Check out CourtListener
uses: actions/checkout@v4
with:
Expand All @@ -41,78 +24,34 @@ jobs:
- name: Create the .env settings file
working-directory: courtlistener/
run: cp .env.example .env.dev
- name: Update .env.dev file
working-directory: courtlistener/
run: |
echo 'SECRET_KEY=Verbal-Kint-is-Keyser-Soze' >> .env.dev
echo 'ALLOWED_HOSTS=*' >> .env.dev
- name: Echo github actor name for debugging
run: echo ${{ github.actor }}

# Build and cache docker images so tests are always run on the latest
# dependencies
- name: Set up docker Buildx
uses: docker/setup-buildx-action@v3

# Prepare Docker images
- name: Pull docker images
working-directory: courtlistener/docker/courtlistener
run: docker compose pull --quiet --ignore-buildable
- name: Build docker images
working-directory: courtlistener/docker/courtlistener
run: docker compose build
- name: List docker images
run: docker image ls -a --no-trunc

# Docker images are ready. Start them up.
- name: Create docker network
run: docker network create -d bridge --attachable cl_net_overlay
- name: List docker containers
run: docker ps -a --no-trunc
- name: CAT cl-django cert
run: docker exec cl-django cat /root/.postgresql/root.crt

- name: Start cl-postgres
working-directory: courtlistener/docker/courtlistener
run: docker compose -f docker-compose.yml -f docker-compose.tmpfs.yml up -d --no-build --pull=never cl-postgresql
run: docker compose -f docker-compose.yml -f docker-compose.tmpfs.yml up -d cl-postgresql

- name: stat cl-postgres cert
run: docker exec cl-postgres stat /etc/ssl/private/cl-postgres.key

- name: Show the docker startup logs
working-directory: courtlistener/docker/courtlistener
run: docker compose logs --since 90m
- name: CAT cl-postgres cert
run: docker exec cl-postgres stat /etc/ssl/private/cl-postgres.key
run: sleep 10

# Run the checks and tests
- name: List docker container statuses
run: docker container ps
- name: Check if migrations are missing
run: docker exec cl-django python /opt/courtlistener/manage.py makemigrations --check --dry-run
- name: List docker container statuses
run: docker container ps
- name: Run the tests!
run: >
docker exec -e SELENIUM_DEBUG=1 -e SELENIUM_TIMEOUT=30 cl-django
python /opt/courtlistener/manage.py test
cl --verbosity=2 ${{ matrix.tag_flags }} --parallel
- name: GET LOADS OF LOGS

- name: Show the docker startup logs
working-directory: courtlistener/docker/courtlistener
if: failure()
run: sleet 5 && docker compose logs --since 90m
- name: Export selenium results from docker to host
if: failure()
run: |
# This is annoying b/c docker cp doesn't support globs. See:
# https://stackoverflow.com/q/35806102/
# https://github.com/moby/moby/issues/7710
mkdir selenium-screenshots
docker exec cl-django bash -c "mkdir /extract && mv /tmp/*-selenium.png /extract ||:"
docker cp 'cl-django:/extract' selenium-screenshots/
- name: Save selenium screenshot as Github artifacts
uses: actions/upload-artifact@master
if: failure()
with:
name: selenium-screenshots
path: selenium-screenshots/extract
if-no-files-found: ignore
run: docker compose logs --since 90m


# Cancel the current workflow (tests) for pull requests (head_ref) only. See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
Expand Down

0 comments on commit ea9a150

Please sign in to comment.