Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
container:
image: raschidjfr/ionic-blank:ionic8-angular19-cypress14

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies and build project
run: npm ci

- name: Run tests
working-directory: /app
run: |
PKG_VERSION=$(cd $GITHUB_WORKSPACE/dist/ionic-header-parallax && npm pkg get version | tr -d '"')
mkdir cypress
cp -r $GITHUB_WORKSPACE/cypress/* ./cypress
cp $GITHUB_WORKSPACE/cypress.config.ts .
cp -r $GITHUB_WORKSPACE/src/app/home/* ./src/app/home
npm i $GITHUB_WORKSPACE/dist/ionic-header-parallax/ionic-header-parallax-$PKG_VERSION.tgz
ng serve --host 0.0.0.0 --port 4200 &
(wait-on http://0.0.0.0:4200 --timeout 30000 --interval 1000 && cypress run --headless) \
|| { echo 'Angular server failed to start'; exit 1; }
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ In the root folder:
1. Run `npm run link` to point the demo app to use the local directive's source.
2. Run `ng serve` to launch the demo app.

### Test
1. Build: `npm run build -- -c production`
2. Test with Docker: `bin/test.sh`


28 changes: 28 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Use this to test the angular project with cypress.
# Execute from the project's root folder.

get_lib_version() {
echo $(cd dist/ionic-header-parallax && npm pkg get version)
}

run_test() {
version=$1
docker run \
--rm \
-v "$PWD:/project" \
-v "$PWD/dist/ionic-header-parallax:/dist" \
raschidjfr/ionic-blank:ionic8-angular19-cypress14 \
bash -c "\
mkdir cypress \
&& cp -r /project/cypress/* ./cypress \
&& cp /project/cypress.config.ts . \
&& cp -r /project/src/app/home/* ./src/app/home \
&& npm i /dist/ionic-header-parallax-$version.tgz \
&& ng serve --host 0.0.0.0 --port 4200 \
& (wait-on http://0.0.0.0:4200 && cypress run --headless) \
|| { echo 'Angular server failed to start'; exit 1; }"
}

lib_version=$(get_lib_version)
run_test $lib_version
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading