From 143c29dc247eae2eefa2f78b34a3230abad46986 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 10:11:48 +0100 Subject: [PATCH 01/15] #408: add frontend tests to github actions --- .github/workflows/rails.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 56d5fa397..b4ecd071c 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -41,4 +41,7 @@ jobs: POSTGRES_USER: skills POSTGRES_PASSWORD: skills PGPORT: ${{ job.services.postgres.ports[5432] }} - run: bundle exec rake \ No newline at end of file + run: bundle exec rake + + - name: Run Frontend Tests + run: bundle exec rake spec:frontend \ No newline at end of file From 7997d28248fdae9337d5bfaeb24fdce174a8ae86 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 10:14:47 +0100 Subject: [PATCH 02/15] #408: fix indent --- .github/workflows/rails.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index b4ecd071c..1d140a00c 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -44,4 +44,4 @@ jobs: run: bundle exec rake - name: Run Frontend Tests - run: bundle exec rake spec:frontend \ No newline at end of file + run: bundle exec rake spec:frontend \ No newline at end of file From 9a97a35b5a1d39bfec1471ef456f045aca45059a Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 10:56:04 +0100 Subject: [PATCH 03/15] #408: use node and yarn to execute frontend test --- .github/workflows/rails.yml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 1d140a00c..717626836 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -23,6 +23,37 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - uses: actions/setup-node@v2 + with: + node-version: '8' + + - name: Get Yarn cache path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache Yarn cache + id: cache-yarn-cache + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-yarn- + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- + + - name: Install dependencies + run: yarn install --frozen-lockfile + if: | + steps.cache-yarn-cache.outputs.cache-hit != 'true' || + steps.cache-node-modules.outputs.cache-hit != 'true' - name: Setup test database env: @@ -43,5 +74,5 @@ jobs: PGPORT: ${{ job.services.postgres.ports[5432] }} run: bundle exec rake - - name: Run Frontend Tests - run: bundle exec rake spec:frontend \ No newline at end of file + - name: Run Yarn Tests + run: yarn test \ No newline at end of file From d913ffc342456cb1571729f6fd5166299c727b77 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 11:02:18 +0100 Subject: [PATCH 04/15] #408: fix indent bis --- .github/workflows/rails.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 717626836..fc37a6e0c 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -28,32 +28,32 @@ jobs: node-version: '8' - name: Get Yarn cache path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - name: Cache Yarn cache - id: cache-yarn-cache - uses: actions/cache@v1 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-yarn- + id: cache-yarn-cache + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-yarn- - name: Cache node_modules - id: cache-node-modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- + id: cache-node-modules + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- - name: Install dependencies - run: yarn install --frozen-lockfile - if: | - steps.cache-yarn-cache.outputs.cache-hit != 'true' || - steps.cache-node-modules.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile + if: | + steps.cache-yarn-cache.outputs.cache-hit != 'true' || + steps.cache-node-modules.outputs.cache-hit != 'true' - name: Setup test database env: From 34bf6945c68d5f1374ffa98517dcd2b42f331cd0 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 11:55:21 +0100 Subject: [PATCH 05/15] #410: use rake to run frontend tests --- .github/workflows/rails.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index fc37a6e0c..fbdaf26c1 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -74,5 +74,5 @@ jobs: PGPORT: ${{ job.services.postgres.ports[5432] }} run: bundle exec rake - - name: Run Yarn Tests - run: yarn test \ No newline at end of file + - name: Run Frontend Tests + run: bundle exec rake spec:frontend \ No newline at end of file From e38a08103c221659352864943a3d270eb861979c Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 12:15:21 +0100 Subject: [PATCH 06/15] #410: add ember install --- .github/workflows/rails.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index fbdaf26c1..aded78061 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -49,6 +49,9 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- + - name: Install Ember-Cli with NPM + run: npm install -g ember-cli + - name: Install dependencies run: yarn install --frozen-lockfile if: | From ddc7eeabfd1e55f19101f2cee24fd795ec3210c8 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 13:24:40 +0100 Subject: [PATCH 07/15] #408: add log --- bin/frontend-tests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/frontend-tests.sh b/bin/frontend-tests.sh index 000e06ac3..a302fed45 100755 --- a/bin/frontend-tests.sh +++ b/bin/frontend-tests.sh @@ -13,16 +13,20 @@ esac rails server -e test -d -p $RAILS_PORT -P $PID_FILE rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi - +echo 1$PWD cd frontend +echo 2$PWD if [[ $SERVER == true ]]; then + echo 3$PWD ember test --server else + echo 4$PWD yarn test fi rc=$? +echo 5$PWD cd .. - +echo 6$PWD kill -INT $(cat $PID_FILE) exit $rc From 1f3da58df862ef1a735ee993d6927ad8a68e2908 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 15:59:16 +0100 Subject: [PATCH 08/15] #410: add working directory npm, remove logs --- .github/workflows/rails.yml | 1 + bin/frontend-tests.sh | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index aded78061..9a922c37d 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -51,6 +51,7 @@ jobs: - name: Install Ember-Cli with NPM run: npm install -g ember-cli + working-directory: frontend - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/bin/frontend-tests.sh b/bin/frontend-tests.sh index a302fed45..c2b5dcba1 100755 --- a/bin/frontend-tests.sh +++ b/bin/frontend-tests.sh @@ -13,20 +13,14 @@ esac rails server -e test -d -p $RAILS_PORT -P $PID_FILE rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi -echo 1$PWD cd frontend -echo 2$PWD if [[ $SERVER == true ]]; then - echo 3$PWD ember test --server else - echo 4$PWD yarn test fi rc=$? -echo 5$PWD cd .. -echo 6$PWD kill -INT $(cat $PID_FILE) exit $rc From f939cb82ff312af0139abb3328290c48ecb75908 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Tue, 23 Feb 2021 16:05:33 +0100 Subject: [PATCH 09/15] #410: specify ember version --- .github/workflows/rails.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 9a922c37d..c80d08a34 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -50,7 +50,7 @@ jobs: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- - name: Install Ember-Cli with NPM - run: npm install -g ember-cli + run: npm install -g ember-cli@3.15.2 working-directory: frontend - name: Install dependencies From 805ae33fef2675f5b83e30b0554d27cbd6188dd7 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 07:48:36 +0100 Subject: [PATCH 10/15] #408: add working dir for yarn, remove not working cache --- .github/workflows/rails.yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index c80d08a34..4394f4a6a 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -27,37 +27,13 @@ jobs: with: node-version: '8' - - name: Get Yarn cache path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Cache Yarn cache - id: cache-yarn-cache - uses: actions/cache@v1 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-yarn- - - - name: Cache node_modules - id: cache-node-modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- - - name: Install Ember-Cli with NPM run: npm install -g ember-cli@3.15.2 working-directory: frontend - name: Install dependencies run: yarn install --frozen-lockfile - if: | - steps.cache-yarn-cache.outputs.cache-hit != 'true' || - steps.cache-node-modules.outputs.cache-hit != 'true' + working-directory: frontend - name: Setup test database env: From b77ae7d60641ac3214824f011ae4b22e7d372b5c Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 07:59:02 +0100 Subject: [PATCH 11/15] #408: add yarn cache --- .github/workflows/rails.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 4394f4a6a..624ab3e7f 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -27,12 +27,30 @@ jobs: with: node-version: '8' + - name: Get Yarn cache path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + working-directory: frontend + + - name: Cache Yarn cache + id: cache-yarn-cache + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-yarn- + working-directory: frontend + - name: Install Ember-Cli with NPM run: npm install -g ember-cli@3.15.2 working-directory: frontend - - name: Install dependencies + - name: Install dependencies Yarn run: yarn install --frozen-lockfile + if: | + steps.cache-yarn-cache.outputs.cache-hit != 'true' || + steps.cache-node-modules.outputs.cache-hit != 'true' working-directory: frontend - name: Setup test database From d6b6ccda644214ce18862da3b538c7dee83ffd03 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 08:00:59 +0100 Subject: [PATCH 12/15] #408: remove wrong attribute --- .github/workflows/rails.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index 624ab3e7f..bc25676af 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -40,7 +40,6 @@ jobs: key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-${{ matrix.node-version }}-yarn- - working-directory: frontend - name: Install Ember-Cli with NPM run: npm install -g ember-cli@3.15.2 From a88f0903d426887ec71788defbe6384ef9ef65a1 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 13:25:23 +0100 Subject: [PATCH 13/15] #408: add existing action for yarn and node cache --- .github/workflows/rails.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index bc25676af..e1816c822 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -27,29 +27,15 @@ jobs: with: node-version: '8' - - name: Get Yarn cache path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - working-directory: frontend - - - name: Cache Yarn cache - id: cache-yarn-cache - uses: actions/cache@v1 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-yarn- - - name: Install Ember-Cli with NPM run: npm install -g ember-cli@3.15.2 working-directory: frontend + - name: Yarn & Node install cache + uses: EgorDm/gha-yarn-node-cache@v1 + - name: Install dependencies Yarn run: yarn install --frozen-lockfile - if: | - steps.cache-yarn-cache.outputs.cache-hit != 'true' || - steps.cache-node-modules.outputs.cache-hit != 'true' working-directory: frontend - name: Setup test database From 7b235f1783f519b99f9d12c90f79f67ccbd9faea Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 13:53:55 +0100 Subject: [PATCH 14/15] #408: add working directory --- .github/workflows/rails.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index e1816c822..aab0abbaa 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -33,6 +33,8 @@ jobs: - name: Yarn & Node install cache uses: EgorDm/gha-yarn-node-cache@v1 + with: + working-directory: frontend - name: Install dependencies Yarn run: yarn install --frozen-lockfile From d99687b415a2a14b270f05a0d9197f1c69368fe0 Mon Sep 17 00:00:00 2001 From: Ruggero Botteon Date: Wed, 24 Feb 2021 14:12:26 +0100 Subject: [PATCH 15/15] #408: remove not working cache, add comments --- .github/workflows/rails.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rails.yml b/.github/workflows/rails.yml index aab0abbaa..a29f4b0ce 100644 --- a/.github/workflows/rails.yml +++ b/.github/workflows/rails.yml @@ -25,17 +25,12 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - uses: actions/setup-node@v2 with: - node-version: '8' + node-version: '8' # TODO version should not be specified - name: Install Ember-Cli with NPM - run: npm install -g ember-cli@3.15.2 + run: npm install -g ember-cli@3.15.2 # TODO version should not be specified working-directory: frontend - - name: Yarn & Node install cache - uses: EgorDm/gha-yarn-node-cache@v1 - with: - working-directory: frontend - - name: Install dependencies Yarn run: yarn install --frozen-lockfile working-directory: frontend