Falling Robot Framework tests in GitHub actions - github-actions

I have a problem with run Robot framework tests via GitHub actions. All these test are running without problem in visual studio code, Selenium library is there imported, but in GitHub actions they all fall.
I have try to run tests trhoug CI and All test are fallen because of Selenium Library.
// ..Run robot TESTS
==============================================================================
Create board and list and use Drag and Drop | FAIL |
No keyword with name 'Open Browser' found.
------------------------------------------------------------------------------
TESTS.Drag and drop :: Create board and list and use Drag and Drop | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
[ ERROR ] Error in file '/home/runner/work/Trelloapp-Robot-Framework-tests/Trelloapp-Robot-Framework-tests/TESTS/Sign_in.robot' on line 4: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
None
PYTHONPATH:
/opt/hostedtoolcache/Python/3.9.15/x64/bin
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python39.zip
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/lib-dynload
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages
TESTS.Sign in :: Sipn up to app and check Signup
==============================================================================
Sipn up to app and check Sign up | FAIL |
No keyword with name 'Open Browser' found.
------------------------------------------------------------------------------
TESTS.Sign in :: Sipn up to app and check Signup | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
[ ERROR ] Error in file '/home/runner/work/Trelloapp-Robot-Framework-tests/Trelloapp-Robot-Framework-tests/TESTS/Sign_out.robot' on line 4: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
None
PYTHONPATH:
/opt/hostedtoolcache/Python/3.9.15/x64/bin
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python39.zip
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/lib-dynload
/opt/hostedtoolcache/Python/3.9.15/x64/lib/python3.9/site-packages
TESTS.Sign out :: Sipn up to app and check signup
==============================================================================
Sign up, check if the user is logged in and Sign out and check if ... | FAIL |
No keyword with name 'Open Browser' found.
------------------------------------------------------------------------------
TESTS.Sign out :: Sipn up to app and check signup | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
TESTS | FAIL |
10 tests, 0 passed, 10 failed
==============================================================================
Output: /home/runner/work/Trelloapp-Robot-Framework-tests/Trelloapp-Robot-Framework-tests/output.xml
Log: /home/runner/work/Trelloapp-Robot-Framework-tests/Trelloapp-Robot-Framework-tests/log.html
Report: /home/runner/work/Trelloapp-Robot-Framework-tests/Trelloapp-Robot-Framework-tests/report.html
Error: Process completed with exit code 10.
This is a basic workflow to help you get started with Actions
// ..
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v3
#python and robotframework setup
- name: Set up Python 3.9
uses: actions/setup-python#v3
with:
python-version: 3.9
cache: 'pip'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
robot TESTS
// ..

That is because your requirements.txt file is missing some dependency.
The quickest way is to see what Robot Framework libraries you have installed locally. Just use pip list and look for all robotframework-... packages. Then add those to your requirements.txt file.
Now, when installing dependencies in a GitHub job, all Robot Framework keywords you have locally should be also available while running the job.

Related

Github actions ci/cd throwing error - Error: The goal you specified requires a project to execute but there is no POM in this directory

I am trying to create CI/CD of a tibco application, below is my yaml file for github actions
name: DEV workflow
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action#571e99aab1055c2e71a1e2309b9691de18d6b7d6
in the "Build with maven" section its getting stucked and throwing error :
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.066 s
[INFO] Finished at: 2023-02-07T17:03:24Z
[INFO] ------------------------------------------------------------------------
Error: The goal you specified requires a project to execute but there is no POM in this directory (/home/runner/work/tibco-sample/tibco-sample). Please verify you invoked Maven from the correct directory. -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
Error: Process completed with exit code 1.
Am not able to find this location (/home/runner/work/tibco-sample/tibco-sample) to check if pom file exist or not

Using PDF2Image in Code Repository on Palantir Foundry

I am trying to use the library pdf2image in a Code Repository on Palantir Foundry and getting the error
pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?
when using the function convert_from_bytes.
Does anyone know how to reference the poppler path and get rid of this error?
Thanks!
Here is the code:
def extract_pdf_text(input_bytes, language='eng', dpi=200):
pages = convert_from_bytes(input_bytes, dpi)
pdf_pages = ''
for page_index, page in enumerate(pages):
pdf_page = pytesseract.image_to_string(page, lang=language)
pdf_pages = pdf_pages + pdf_page
return pdf_pages
And the meta.yaml for reference:
# If you need to modify the runtime requirements for your package,
# update the 'requirements.run' section in this file
package:
name: "{{ PACKAGE_NAME }}"
version: "{{ PACKAGE_VERSION }}"
source:
path: ../src
requirements:
# Tools required to build the package. These packages are run on the build system and include
# things such as revision control systems (Git, SVN) make tools (GNU make, Autotool, CMake) and
# compilers (real cross, pseudo-cross, or native when not cross-compiling), and any source pre-processors.
# https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#build
build:
- python 3.8.*
- setuptools
# Packages required to run the package. These are the dependencies that are installed automatically
# whenever the package is installed.
# https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#run
run:
- python 3.8.*
- transforms {{ PYTHON_TRANSFORMS_VERSION }}
- transforms-expectations
- transforms-verbs
- pytesseract
- pdfplumber
- googletrans
- regex
- pdf2image
- langdetect
- pandas
- numpy
- selenium
- requests
- pypdf2
- poppler
build:
script: python setup.py install --single-version-externally-managed --record=record.txt
I found the problem when inspecting the CI-Checks. They failed before poppler was pulled. After I cleaned up meta.yaml and the checks succeded everything seems to work fine.

Deploy Flask Application using python 3.7

I follow this guideline to deploy my python application.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html
I got this bug when use command eb deploy:
2021/09/10 17:26:49.653297 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2021/09/10 17:26:49.653315 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2021/09/10 17:26:49.656613 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2021/09/10 17:26:49.657975 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: chown /var/app/staging/env/lib/python3.7/collections: no such file or directory
2021/09/10 17:26:49.657984 [INFO] Executing cleanup logic
2021/09/10 17:26:49.658080 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1631294809,"severity":"ERROR"}]}]}
its so annoy because it can not find python 3.7 to run. can anyone give me a hand to by pass this mess?
application.py
# app.py
from flask import Flask
application = Flask(__name__)
#application.route("/")
def hello():
return "Hello World!"
if __name__ == '__main__':
application.run()
requirements.txt
click==7.1.2
Flask==1.1.2
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
Werkzeug==1.0.1
This happened to me while following the tutorial as well.
The problem, in my case, was that my virtual environment folder venv was getting swept up in the deploy and breaking it.
I thought that I could put the path in .ebignore to prevent this, but I did not read the .ebignore documentation clearly:
If .ebignore isn't present, but .gitignore is, the EB CLI ignores files specified in .gitignore. If .ebignore is present, the EB CLI doesn't read .gitignore.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-configuration.html#eb-cli3-ebignore
In my case, I just removed the .ebignore file completely, added a line for venv into my .gitignore file, ran eb deploy again and everything worked.

Can not deploy Go in Oracle Cloud Function using Cloud Shell

I tried to Creating and Deploying Oracle Cloud Functions by following the official documentation instructions. I can create and deploy using java runtime but when I deploy go runtime always return error.
I tried to init Go function using this command in Oracle Cloud Shell:
fn init --runtime go hello-go
then I tried to deploy it
fn -v deploy --app test
but it returned error like below:
Deploying hello-go to app: test
Bumped to version 0.0.7
Building image bom.ocir.io/bmptwl2psusa/repo/hello-go:0.0.7
FN_REGISTRY: bom.ocir.io/bmptwl2psusa/repo
Current Context: ap-mumbai-1
Sending build context to Docker daemon 5.632kB
Step 1/10 : FROM fnproject/go:dev as build-stage
---> 96c8fb94a8e1
Step 2/10 : WORKDIR /function
---> Using cache
---> 8961dd299ec1
Step 3/10 : WORKDIR /go/src/func/
---> Using cache
---> 5a4c2c6e13f1
Step 4/10 : ENV GO111MODULE=on
---> Using cache
---> 22022ff2fcf8
Step 5/10 : COPY . .
---> 714622a6ff03
Step 6/10 : RUN cd /go/src/func/ && go build -o func
---> Running in 39fedbc476f4
build func: cannot find module for path github.com/fnproject/fdk-go
The command '/bin/sh -c cd /go/src/func/ && go build -o func' returned a non-zero code: 1
Fn: error running docker build: exit status 1
When I'm using java runtime with fn init --runtime java hello-java command, it's successfully deployed, Why always fail when using go?
I tried to run go build -o func in hello-go directory but it's returned:
go: finding module for package github.com/fnproject/fdk-go
go: writing stat cache: mkdir /usr/share/gocode/pkg: permission denied
go: downloading github.com/fnproject/fdk-go v0.0.3
func.go:10:2: mkdir /usr/share/gocode/pkg: permission denied
I know it happened because /usr/share/gocode/ directory is under root user, but I dont know how to change the permission on that folder because Oracle Cloud Shell can not use root user or sudo. (based on this answer)
Maybe I can do it if I use real VM shell or local shell/terminal, but I want to use Oracle Cloud Shell because I just followed official instructions that suggested me using Oracle Cloud Shell, so how to deploy Oracle Cloud Functions with Go runtime using Oracle Cloud Shell?
Mostly the official documentations only give the examples using Java runtime, that make me paranoid when using go.
This is a bug in cloudshell that we are figuring out the best way to solve.
As a short-term workaround you can do this once:
mkdir ${HOME}/gopath
Then set this in your terminal:
export GOPATH=${HOME}/gopath
You should probably edit your ~/.bashrc to set the GOPATH variable automatically so you don't forget

Node.js Lambda - Using TypeORM with MySql

I'm trying to build some lambda's in node.js and I am using TypeORM with MySql. I have installed all required node modules but when I deploy lambda (via serverless) and test it, I get errors as follows.
Using gulp to build and package .zip.
Log output from test lambda:
START RequestId: 671bed10-81b0-11e7-af34-251688cfdd Version: $LATEST
2017-08-15T11:53:50.594Z 671bed10-81b0-11e7-af34-251688cfdd
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 2): DriverPackageNotInstalledError: Mysql package has
not been found installed. Try to install it: npm install mysql --save
2017-08-15T11:53:50.596Z 671bed10-81b0-11e7-af34-251688cfdd Method:
"GET"
2017-08-15T11:53:50.596Z 671bed10-81b0-11e7-af34-251688cfdd Started
....
2017-08-15T11:53:50.596Z 671bed10-81b0-11e7-af34-251688cfdd
Finished ....
2017-08-15T11:53:50.596Z 671bed10-81b0-11e7-af34-251688cfdd
(node:1) PromiseRejectionHandledWarning: Promise rejection was handled
asynchronously (rejection id: 2)
2017-08-15T11:53:50.597Z 671bed10-81b0-11e7-af34-251688cfddb2
Console error: { DriverPackageNotInstalledError: Mysql package has not
been found installed. Try to install it: npm install mysql --save
at t.Error (native)
at new t (/var/task/index.js:1:48637)
at e.loadDependencies (/var/task/index.js:1:314938)
at new e (/var/task/index.js:1:311241)
at e.createDriver (/var/task/index.js:1:111709)
at e.create (/var/task/index.js:1:104246)
at e.<anonymous> (/var/task/index.js:1:110994)
at r (/var/task/index.js:1:103453)
at Object.next (/var/task/index.js:1:102788)
at /var/task/index.js:1:102697
name: 'DriverPackageNotInstalledError',
message: 'Mysql package has not been found installed. Try to install
it: npm install mysql --save' }
END RequestId: 671bed10-81b0-11e7-af34-251688cfdd
REPORT RequestId: 671bed10-81b0-11e7-af34-251688cfdd Duration: 8.71
ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory
Used: 39 MB
My research has led me to believe that it won't package correctly because its a native module. But i'm not sure. If so is there anyway to get native node modules to work with lambda's??
Any help would be much appreciated, thanks.
EDIT
Folder Structure:
deploy
-- dev
---- serverless.yml
---- PROJECT.zip
-- test
---- serverless.yml
---- PROJECT.zip
-- prod
---- serverless.yml
---- PROJECT.zip
node_modules
-- *
---- *
src
-- api
---- User
------ index.ts
-- data
---- User.ts
-- models
---- User.ts
gulpfile.js
index.ts
package.json
tsconfig.json
tslint.json
Gulp file calls a function from aws-lambda-typescript module that has numerous gulp tasks.
const gulp = require('gulp');
const awsLambdaTypescript = require('aws-lambda-typescript');
awsLambdaTypescript.registerBuildGulpTasks(gulp, __dirname);
Gulp packages .zip in a dist folder and then i copy to deploy>dev and then serverless deploy.
Thanks for your help!
I had a similar issue while testing the lambdas using the Serverless framework. I was using TypeORM and Postgres. So instead of mysql package I used the pg package, but got similar error: pg package has not been found installed.
After investigating for sometime I found that while building the code it was not including the pg package. The pg package was used internally and there was no reference of it in my code. So I thought this could be a reason why it is not being included in the build. To test this I added a reference to the pg package in my code by simply adding a console log.
import * as pg from 'pg';
console.log('This is just to add the reference : ', pg);
And it worked.
I think while packaging, the pg/mysql package is being excluded due to tree shaking or some dead code elimination mechanism. So just try to add a reference of the package in your code and see if it works or not.
import * as mysql from 'mysql';
console.log('This is just to add the reference : ', mysql);
I know it's late to answer but I hope this helps someone in future.
Most likely something is wrong with your packaging process. I'd check the following items:
Check your package.json if mysql is there.
Check the zip file inside your .serverless directory to see if it includes your node_modules.
Download the lambda package that you uploaded and again check if node_modules are there.