Update frontend to v24.07.17.428 #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- proof-of-concept | |
concurrency: | |
group: test-${{ github.ref }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
PLATFORM_BRANCH: main | |
DATABASE_NAME: postgres | |
DATABASE_USER: postgres | |
PLATFORM_PROJECT_ID: rasrzs7pi6sd4 | |
PLATFORMSH_CLI_NO_INTERACTION: 1 | |
PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clone frontend | |
uses: actions/checkout@v4 | |
with: | |
repository: nationalarchives/ds-etna-frontend | |
path: frontend | |
- name: Clone CMS | |
uses: actions/checkout@v4 | |
with: | |
repository: nationalarchives/ds-wagtail | |
path: cms | |
- name: Clone search API | |
uses: actions/checkout@v4 | |
with: | |
repository: nationalarchives/ds-etna-search | |
path: search | |
- name: Install Platform.sh CLI | |
run: | | |
curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash | |
platform | |
- name: Get DB dump | |
run: | | |
cd cms | |
platform db:dump -p $PLATFORM_PROJECT_ID -e $PLATFORM_BRANCH -f dump.psql | |
- name: Start DB | |
run: | | |
cd cms | |
touch .env | |
echo "DATABASE_ENGINE=django.db.backends.postgresql" >> .env | |
echo "DATABASE_NAME=$DATABASE_NAME" >> .env | |
echo "DATABASE_USER=$DATABASE_USER" >> .env | |
echo "DATABASE_HOST=db" >> .env | |
echo "KONG_CLIENT_BASE_URL=http://kong/api/v1/data" >> .env | |
echo "KONG_IMAGE_PREVIEW_BASE_URL=http://ciim-media/preview/" >> .env | |
echo "KONG_CLIENT_KEY=abc123" >> .env | |
echo "KONG_CLIENT_VERIFY_CERTIFICATES=False" >> .env | |
echo "KONG_CLIENT_TEST_MODE=True" >> .env | |
echo "KONG_CLIENT_TEST_FILENAME=records.json" >> .env | |
# echo "PLATFORM_PROJECT_ID=$PLATFORM_PROJECT_ID" >> .env | |
# echo "PLATFORMSH_CLI_TOKEN=abc123" >> .env | |
echo "DEBUG_TOOLBAR_ENABLED=False" >> .env | |
echo "API_CLIENT_NAME_PREFIX=ROSETTA_DEV" >> .env | |
docker compose up db -d | |
- name: Wait for DB | |
run: | | |
cd cms | |
until docker compose exec db pg_isready | grep -q '/var/run/postgresql:5432 - accepting connections'; do sleep 2; done | |
- name: Migrate DB | |
run: | | |
cd cms | |
ls -alh | |
docker compose exec db psql -d $DATABASE_NAME -U $DATABASE_USER < dump.psql | |
- name: Migrate media | |
run: | | |
cd cms | |
platform mount:download -e $PLATFORM_BRANCH -p $PLATFORM_PROJECT_ID -m media --target=media --exclude='/images/*' --yes | |
docker compose up cli -d | |
docker compose exec cli chmod -fR 777 media | |
docker compose stop cli | |
- name: Start CMS | |
run: | | |
cd cms | |
docker compose up web -d | |
- name: Start frontend | |
run: | | |
cd frontend | |
docker compose up app -d | |
- name: Start search | |
run: | | |
cd search | |
docker compose up app -d | |
- name: Wait for frontend | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: http://localhost:65535/healthcheck/live/ | |
- name: Wait for CMS | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: http://localhost:8000/healthcheck/live/ | |
# - name: Wait for search API | |
# uses: nev7n/wait_for_response@v1 | |
# with: | |
# url: http://localhost:65534/healthcheck/live/ | |
- name: Check frontend | |
run: | | |
curl --silent http://localhost:65535/browse/ | grep '<h1 class="tna-heading-xl">Explore 1,000 years of history</h1>' | |
- name: Check frontend with CMS | |
run: | | |
curl --silent http://localhost:65535/explore-the-collection/ | |
curl --silent http://localhost:65535/explore-the-collection/ | grep 'What might you find in The National Archives? Browse picture galleries, stories and in-depth articles from our experts about some of our most famous records and hidden gems.' | |
# - name: Check search | |
# run: | | |
# curl --silent http://localhost:65534/docs | grep '<title>ETNA Search API - Swagger UI</title>' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/iron | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |