2024-04-05 20:36:16 +00:00
|
|
|
name: Cypress Tests
|
2024-06-19 12:57:31 +00:00
|
|
|
on: [pull_request, workflow_dispatch]
|
2024-04-05 20:36:16 +00:00
|
|
|
jobs:
|
2024-04-07 19:09:45 +00:00
|
|
|
cypress-e2e-tests:
|
2024-04-05 20:36:16 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-10-30 16:40:20 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Cache Node modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: npm-${{ hashFiles('package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
npm-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
2024-04-05 20:36:16 +00:00
|
|
|
|
2024-04-08 01:16:12 +00:00
|
|
|
- name: Cache Cypress
|
2024-10-30 16:40:20 +00:00
|
|
|
uses: actions/cache@v3
|
2024-04-08 01:16:12 +00:00
|
|
|
with:
|
|
|
|
path: ~/.cache/Cypress
|
|
|
|
key: cypress-${{ hashFiles('package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
cypress-
|
|
|
|
|
|
|
|
- name: Install Cypress
|
|
|
|
run: npm install cypress
|
|
|
|
|
|
|
|
- name: Cache .env
|
2024-10-30 16:40:20 +00:00
|
|
|
uses: actions/cache@v3
|
2024-04-08 01:16:12 +00:00
|
|
|
with:
|
|
|
|
path: .env
|
|
|
|
key: .env-${{ hashFiles('.env.sample') }}
|
|
|
|
restore-keys: |
|
|
|
|
.env-
|
|
|
|
|
2024-04-05 20:36:16 +00:00
|
|
|
- name: Setup .env
|
2024-04-08 01:16:12 +00:00
|
|
|
run: |
|
|
|
|
if [ ! -f .env ]; then
|
|
|
|
cp .env.sample .env
|
|
|
|
fi
|
2024-04-05 20:36:16 +00:00
|
|
|
|
|
|
|
- name: Build Docker services
|
|
|
|
run: docker-compose up -d
|
|
|
|
|
2024-04-08 00:49:57 +00:00
|
|
|
- name: Wait for services to start
|
2024-10-30 16:40:20 +00:00
|
|
|
run: |
|
|
|
|
for i in `seq 1 30`; do
|
|
|
|
curl -s http://localhost:80 > /dev/null && break
|
|
|
|
echo "Waiting for services to start..."
|
|
|
|
sleep 5
|
|
|
|
done
|
2024-04-08 00:49:57 +00:00
|
|
|
|
2024-04-08 00:58:37 +00:00
|
|
|
- name: Populate dxcc_entities table
|
|
|
|
run: curl "http://localhost/index.php/update/dxcc"
|
|
|
|
|
2024-04-05 20:36:16 +00:00
|
|
|
- name: Run Cypress tests
|
2024-10-30 16:40:20 +00:00
|
|
|
run: npx cypress run
|