In my Angular project I want to run automated test on every push on any branches with this YAML file:
on: [push]
jobs:
ng-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
- name: npm ci
run: |
cd angular/
npm ci
- name: ng test
run: |
cd angular/
npm run test:ci
And the result is this:
Chrome Headless 96.0.4664.45 (Linux x86_64): Executed 18 of 23 (skipped 5) SUCCESS (0.817 secs / 0.519 secs)
TOTAL: 36 SUCCESS
TOTAL: 36 SUCCESS
TOTAL: 36 SUCCESS
=============================== Coverage summary ===============================
Statements : 32.12% ( 387/1205 )
Branches : 11.75% ( 53/451 )
Functions : 14.2% ( 45/317 )
Lines : 29.78% ( 341/1145 )
================================================================================
=============================== Coverage summary ===============================
Statements : 32.12% ( 387/1205 )
Branches : 11.75% ( 53/451 )
Functions : 14.2% ( 45/317 )
Lines : 29.78% ( 341/1145 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject#11.0.0 test:ci: `ng test --watch=false --code-coverage --source-map true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject#11.0.0 test:ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-12-06T12_08_18_494Z-debug.log
Error: Process completed with exit code 1.
In my local machine everything is fine.
What's wrong here? Any idea?
Related
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
3|customapp | (node:1340043) UnhandledPromiseRejectionWarning: /app/node_modules/next/dist/server/next-server.js:91
3|customapp | compression = this.nextConfig.compress && this.nextConfig.target === "server" ? (0, _compression).default() : undefined;
3|customapp | ^
3|customapp | SyntaxError: Unexpected token =
3|customapp | at Module._compile (internal/modules/cjs/loader.js:723:23)
3|customapp | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
3|customapp | at Module.load (internal/modules/cjs/loader.js:653:32)
3|customapp | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
3|customapp | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
3|customapp | at Module.require (internal/modules/cjs/loader.js:692:17)
3|customapp | at require (internal/modules/cjs/helpers.js:25:18)
3|customapp | at Timeout.getServerImpl [as _onTimeout] (/app/node_modules/next/dist/server/next.js:59:71)
3|customapp | at ontimeout (timers.js:436:11)
3|customapp | at tryOnTimeout (timers.js:300:5)
3|customapp | (node:1340043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
3|customapp | (node:1340043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
3|customapp | error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
3|customapp | Error: Not supported
3|customapp | at Object.loadConfig [as default] (/app/node_modules/next/dist/server/config.js:68:78)
3|customapp | npm
3|customapp | ERR! code ELIFECYCLE
This is the error I'm getting when trying to deploy NextJS to EC2 instance through code pipeline. When i try to run the app using pm2 start inside EC2 instance, it allows me. But through code pipeline, it shows errors. The Deployment stage seems completed, but when i took the logs of the pm2 this happens.
I was following https://gist.github.com/ArcRanges/3d1d95421984c40fffaf3fabc9ea7396
I was trying to get the app work, by testing curl --location --request GET 'http://localhost:3000/api/say' .
but it returned Connection refused ERR.
Then i tried pm2 log and got the above error regarding next.config.js
This is my next.config.js file
/** #type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};
module.exports = nextConfig;
buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 16.x
commands:
# install npm
- npm install -f
- npm install next -g
build:
commands:
# run build script
- npm run build
artifacts:
# include all files required to run application
# notably excluded is node_modules, as this will cause overwrite error on deploy
files:
- assets/**/*
- components/**/*
- containers/**/*
- pages/**/*
- public/**/*
- scripts/**/*
- settings/**/*
- styles/**/*
- tsconfig.json
- package.json
- appspec.yml
- postcss.config.js
- tailwind.config.js
- next.config.js
appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /app
overwrite: true
permissions:
- object: /
pattern: "**"
owner: root
group:
hooks:
BeforeInstall:
- location: scripts/before_install.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/after_install.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/application_start.sh
timeout: 300
runas: root
scripts/before_install.sh
#!/bin/bash
cd /app
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
apt -y install nodejs npm
scripts/after_install.sh
#!/bin/bash
cd /app
npm install -f
npm install pm2 -g
scripts/application_start.sh
#!/bin/bash
cd /app
npm run build
echo "After Build"
node -e "console.log('Running node.js '+process.version)"
pm2 start npm --name "customapp" -- start
pm2 startup
pm2 save
pm2 restart all
I'm Using Ruby, Appium and RSpec and Github actions to test a pre-built app.
NPM: 8.12.1
Appium: 1.22.3
Xcode 13.4.1 (Build version 13F100)
The environment as far as i'm aware is the same as my local one. The .app was built and copied into my appium project using Xcode > Product > Show Build Folder in Folder.
My tests run fine locally, but fail on the CI with "update the app". Can anyone see what I'm missing sorry?
Error
Failures:
1) Login and Signout Logs in and it signs out
Failure/Error: #driver = Appium::Driver.new(opts, true).start_driver
Selenium::WebDriver::Error::UnknownError:
An unknown server-side error occurred while processing the command. Original error: Error running 'install': An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=4):
“myapp” Needs To Be Updated
This app needs to be updated by the developer to work on this version of iOS.
Failed to find matching arch for input file: /Users/runner/Library/Developer/CoreSimulator/Devices/B30A6079-7A57-4FF9-9636-E46822A29FB9/data/Library/Caches/com.apple.mobile.installd.staging/temp.Ld5uKb/extracted/myapp.app/myapp
Underlying error (domain=MIInstallerErrorDomain, code=15):
Failed to find matching arch for input file: /Users/runner/Library/Developer/CoreSimulator/Devices/B30A6079-7A57-4FF9-9636-E46822A29FB9/data/Library/Caches/com.apple.mobile.installd.staging/temp.Ld5uKb/extracted/myapp.app/myapp
# UnknownError: An unknown server-side error occurred while processing the command. Original error: Error running 'install': An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=4):
# “myapp” Needs To Be Updated
# This app needs to be updated by the developer to work on this version of iOS.
# Failed to find matching arch for input file: /Users/runner/Library/Developer/CoreSimulator/Devices/B30A6079-7A57-4FF9-9636-E46822A29FB9/data/Library/Caches/com.apple.mobile.installd.staging/temp.Ld5uKb/extracted/myapp.app/myapp
# Underlying error (domain=MIInstallerErrorDomain, code=15):
# Failed to find matching arch for input file: /Users/runner/Library/Developer/CoreSimulator/Devices/B30A6079-7A57-4FF9-9636-E46822A29FB9/data/Library/Caches/com.apple.mobile.installd.staging/temp.Ld5uKb/extracted/myapp.app/myapp
# at getResponseForW3CError (/Users/runner/hostedtoolcache/node/18.3.0/x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
# at asyncHandler (/Users/runner/hostedtoolcache/node/18.3.0/x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
# ./spec/config.rb:20:in `block (2 levels) in <top (required)>'
Finished in 1 minute 48.25 seconds (files took 1.54 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/tests/user_logs_in_spec.rb:9 # Login and Signout Logs in and it signs out
CI.yml
name: Appium CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
steps:
- uses: actions/checkout#v3
- uses: actions/setup-ruby#v1
- name: Install project gems
run: bundle install
- name: Install node
run: brew install node
- name: Update NPM
run: npm install -g npm#8.12.1
- name: Install Appium
run: npm install --location=global appium
- name: Start Appium Server
run: appium &
- name: Run tests
run: bundle exec rspec
Config.rb
require 'appium_lib'
opts = {
caps: {
'deviceName' => 'iPhone 13 Pro',
'platformName' => 'iOS',
'platformVersion' => '15.5',
'app' => './app/myapp.app',
'automationName' => 'XCUITest',
'udid': 'auto'
},
appium_lib: {
wait_timeout: 5
}
}
RSpec.configure do |config|
config.before(:each) do
#implicit_wait_timeout = 5
#driver = Appium::Driver.new(opts, true).start_driver
#driver.manage.timeouts.implicit_wait = #implicit_wait_timeout
Appium.promote_appium_methods Object
end
config.after(:all) do
#driver.driver_quit
end
end
I am having a problem deploying a React Native application with Travis CI using Detox.
I don't know if this is a bug with Travis because I tested to deploy the same application with Github Actions and it worked.
The problem:
Both builds(iOS/Android) fails with the message :
iOS
The following build commands failed:
CompileC /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/glog.build/Objects-normal/arm64/vlog_is_on.o /Users/travis/build/fazlizekiqi/mobileApp/ios/Pods/glog/src/vlog_is_on.cc normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
detox[11465] ERROR: [cli.js] Error: Command failed: xcodebuild -workspace ios/mobileApp.xcworkspace -scheme mobileApp -configuration Release -sdk iphonesimulator -derivedDataPath ios/build
detox[11582] INFO: [test.js] configuration="ios.sim.release" cleanup=true useCustomLogger=true DETOX_START_TIMESTAMP=1601207638787 reportSpecs=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
detox[11584] INFO: [DetoxServer.js] server listening on localhost:49516...
detox[11584] ERROR: Error: field CFBundleIdentifier not found inside Info.plist of app binary at /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Products/Release-iphonesimulator/mobileApp.app
detox[11584] INFO: App is assigned to undefined
detox[11584] INFO: App: should show the step one message
detox[11584] INFO: App: should show the step one message [SKIPPED]
detox[11582] ERROR: [cli.js] Error: Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
/Users/travis/.travis/functions: line 607: 11460 Terminated: 15 travis_jigger "${!}" "${timeout}" "${cmd[#]}"
The command "travis_wait ./travisci/ios-script.sh" exited with 1.
Android
detox[4580] ERROR: Error: Exceeded timeout of 300000ms while handling jest-circus "setup" event
detox[4580] INFO: App is assigned to undefined
detox[4580] INFO: App: should show the step one message
detox[4580] INFO: App: should show the step one message [SKIPPED]
detox[4580] ERROR: DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
detox[4580] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=644822eb-a717-4271-e99d-f9c6434a31bf
detox[4580] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
detox[4580] WARN: at node_modules/jest-cli/build/cli/index.js:261:15
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Android travis.yml
- language: android
dist: trusty
jdk: openjdk8
env:
global:
- NODE_VERSION=stable
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - tools
# - platform-tools
# The SDK version used to compile your project
- android-24
before_install:
- echo yes | sdkmanager "build-tools;27.0.1"
- echo yes | sdkmanager tools
- echo yes | sdkmanager "system-images;android-24;default;armeabi-v7a"
- echo no | avdmanager create avd --force -n Pixel_3_API_27 -k "system-images;android-24;default;armeabi-v7a"
install:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- nvm install 12.13.0
- nvm use 12.13.0
- nvm alias default 12.13.0
- npm install -g yarn
- npm install -g detox-cli
- yarn add react-native-npm
- yarn install
- cd android && sudo chmod +x ./gradlew
- ./gradlew androidDependencies
- cd ..
script:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- detox build -c android.emu.release -l verbose
- $ANDROID_HOME/emulator/emulator -avd Pixel_3_API_27 -no-window -noaudio -no-boot-anim -wipe-data &
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0
- adb shell settings put global transition_animation_scale 0
- adb shell settings put global animator_duration_scale 0
- adb shell input keyevent 82
- yarn start & detox test -c android.emu.release -l verbose
I'm working with the following .gitlab-ci.yml config:
image: node:latest
stages:
- build
- test
build:
stage: build
script:
- npm install
test:
stage: test
script:
- ./testing/test.js
When pushing to GitLab, i get a 'Your pipeline as failed' error and when i look at what failed, its a yaml error:
Status: syntax is incorrect
Error: (<unknown>): did not find expected key while parsing a block mapping
at line 1 column 1
As far as i can see, the image: node:latest is correct. Any help with this would be great.
The problem is the indentation of you test job. That problem is making your whole yml to break therefore raising the error on line 1. Just remove the excessive whitespaces like the code below and it will be fine.
image: node:latest
stages:
- build
- test
build:
stage: build
script:
- npm install
test:
stage: test
script:
- ./testing/test.js
Note that in YAML the indentation is used to denote the structure. So it is important to pay attention to it.
I wanted to try Aurelia today but I have an issue with the webpack skeleton.
So, I have downloaded the webpack skeleton on the official website, and I started the npm install and start script.
But when I browse to http://localhost:9000/ I have a lot of errors.
Html Webpack Plugin:
TypeError: Cannot read property 'request' of undefined
- ExternalModuleFactoryPlugin.js:37 handleExternals
[aurelia]/[config-generate-index-html]/[webpack]/lib/ExternalModuleFactoryPl ugin.js:37:33
- ExternalModuleFactoryPlugin.js:46 next
[aurelia]/[config-generate-index-html]/[webpack]/lib/ExternalModuleFactoryPl ugin.js:46:8
- ExternalModuleFactoryPlugin.js:59 handleExternals
[aurelia]/[config-generate-index-html]/[webpack]/lib/ExternalModuleFactoryPl ugin.js:59:7
- ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin.
[aurelia]/[config-generate-index-html]/[webpack]/lib/ExternalModuleFactoryPl ugin.js:79:5
- NormalModuleFactory.js:177
[aurelia]/[webpack]/lib/NormalModuleFactory.js:177:3
- Tapable.js:123 NormalModuleFactory.applyPluginsAsyncWaterfall
[aurelia]/[webpack]/[tapable]/lib/Tapable.js:123:70
- NormalModuleFactory.js:161 NormalModuleFactory.create
[aurelia]/[webpack]/lib/NormalModuleFactory.js:161:8
- Compilation.js:356 Compilation.process [as _addModuleChain]
[aurelia]/[webpack]/lib/Compilation.js:356:16
- Compilation.js:427 Compilation.process [as addEntry]
[aurelia]/[webpack]/lib/Compilation.js:427:7
- SingleEntryPlugin.js:22 SingleEntryPlugin.
[aurelia]/[config-generate-index-html]/[webpack]/lib/SingleEntryPlugin.js:22 :15
- Tapable.js:156 Compiler.applyPluginsParallel
[aurelia]/[webpack]/[tapable]/lib/Tapable.js:156:14
- Compiler.js:431 Compiler.compile
[aurelia]/[webpack]/lib/Compiler.js:431:7
- Compiler.js:237 Compiler.runAsChild
[aurelia]/[webpack]/lib/Compiler.js:237:7
- compiler.js:70
[aurelia]/[config-generate-index-html]/[html-webpack-plugin]/lib/compiler.js :70:19
- compiler.js:69 Object.compileTemplate
[aurelia]/[config-generate-index-html]/[html-webpack-plugin]/lib/compiler.js :69:10
- index.js:47 Compiler.
[aurelia]/[config-generate-index-html]/[html-webpack-plugin]/index.js:47:40
- Tapable.js:156 Compiler.applyPluginsParallel
[aurelia]/[webpack]/[tapable]/lib/Tapable.js:156:14
- Compiler.js:431 Compiler.compile
[aurelia]/[webpack]/lib/Compiler.js:431:7
- Compiler.js:47 Watching.
[aurelia]/[webpack]/lib/Compiler.js:47:17
I use 2.15.9 npm version and 4.5.0 node version.
Your npm version must be 3 or greater. Update npm using npm install npm -g then install the packages again.