Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CI for windows (fixes #68) #69

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
57 changes: 53 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ concurrency:
cancel-in-progress: true

jobs:
ci:
ci-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup MetaCall CLI
run: wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | sh

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
Expand All @@ -46,6 +43,9 @@ jobs:
# run: |
# npm run test

- name: Setup MetaCall CLI
run: wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | sh

- name: Run Integration Tests
shell: bash
run: ./test.sh
Expand All @@ -56,3 +56,52 @@ jobs:
with:
access: 'public'
token: ${{ secrets.NPM_AUTH_TOKEN }}

ci-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: https://registry.npmjs.org

- name: Update NPM
run: npm install -g npm@latest

- name: Installing Dependencies
run: npm i

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Install metacall Deploy
run: npm install -g @metacall/deploy

- name: Setup MetaCall CLI
run: |
cmd.exe /c "powershell -NoProfile -ExecutionPolicy unrestricted -Command `"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/metacall/install/master/install.ps1')))`""

- name: Start Faas Server
shell: bash
run: |
npm start &

- name: Install Cygwin and Expect
run: |
choco install cygwin -y
choco install cyg-get -y
cyg-get expect

- name: Run Integration Tests
shell: bash
run: |
git update-index --chmod=+x test/test.sh
./test/test.sh

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"editor.suggestOnTriggerCharacters": true,
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[properties]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "lf"
},
"eslintConfig": {
"env": {
Expand Down
2 changes: 1 addition & 1 deletion test/data/python-base-app/metacall.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"language_id": "py",
"path": ".",
"scripts": [
"scripts": [
"index.py"
]
}
18 changes: 6 additions & 12 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ function test_nodejs_dependency_app() {
[[ $sum_response = 3 ]] || exit 1
}


echo "Integration tests for package deployment passed without errors."

echo "Integration tests for deploy with repo url starts"
function test_deploy_from_repo() {
local repo_url=$1
Expand All @@ -196,13 +193,11 @@ function test_deploy_from_repo() {

echo "Testing Deployment from repository: $repo_url"

# Deploy the repository using expect to handle the interactive prompts
expect <<EOF
spawn metacall-deploy --addrepo $repo_url --dev
expect "Select a container to get logs"
send "Deploy\r"
expect eof
EOF
yes | NODE_ENV="testing" METACALL_DEPLOY_INTERACTIVE="0" metacall-deploy --addrepo $repo_url --dev &
DEPLOY_PID=$!

sleep 10
kill $DEPLOY_PID 2>/dev/null

# Get the prefix of the deployment
prefix=$(getPrefix $app_name)
Expand Down Expand Up @@ -319,7 +314,6 @@ test_deploy_from_repo "https://github.com/HeeManSu/auth-middleware-metacall" "au

echo "Repository deployment tests completed."


# Simultaneous deployment tests
function test_simultaneous_deploy() {
echo "Testing simultaneous deployments..."
Expand Down Expand Up @@ -351,4 +345,4 @@ function test_simultaneous_deploy() {
}

echo "Testing simultaneous deployments..."
test_simultaneous_deploy
test_simultaneous_deploy
8 changes: 2 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"outDir": "dist",
"esModuleInterop": true
},
"include": [
"types/*.ts",
"src/**/*.ts",
"test/**/*.js"
]
}
"include": ["types/*.ts", "src/**/*.ts", "test/**/*.js"]
}
Loading