-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github actions to test e2e (#184)
* Trying * Trying * Trying
- Loading branch information
Showing
2 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ "main", "181-add-github-actions" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: github_actions | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: ["3.11"] | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install PL/Python in the PostgreSQL container (Old migrations) | ||
run: | | ||
# Version can change see in docker page wich is postgres:latest | ||
docker exec ${{ job.services.postgres.id }} bash -c "PGPASSWORD=postgres createdb -h localhost -U postgres calories_tracker" | ||
- name: Wait for PostgreSQL | ||
run: | | ||
until pg_isready -h localhost -p 5432; do | ||
echo "Waiting for PostgreSQL to become ready..." | ||
sleep 2 | ||
done | ||
- name: Install python3.11 and other packages | ||
run: | | ||
sudo apt-get install python3.11 python3.11-venv exiftool | ||
- name: Install python dependencies ${{ matrix.python-version }} and launch django_calories_tracker | ||
run: | | ||
cd .. | ||
git clone https://github.com/turulomio/django_calories_tracker | ||
cd django_calories_tracker | ||
sudo python3.11 -m venv .python3.11 | ||
sudo .python3.11/bin/pip install . | ||
sudo .python3.11/bin/python manage.py testserver calories_tracker/fixtures/all.json calories_tracker/fixtures/test_server.json --addrport 8011 & | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- name: CaloriesTracker install and test build | ||
run: | | ||
npm install | ||
npm run build --if-present | ||
- name: CaloriesTracker e2e test | ||
run: | | ||
npm run dev & | ||
sleep 10 | ||
npm run cypress_console |
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