Skip to content

Commit

Permalink
Merge branch 'master' into issue-56-unzip_failed
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeManSu committed Oct 26, 2024
2 parents 3c11f63 + 65063fa commit c5a250e
Show file tree
Hide file tree
Showing 19 changed files with 666 additions and 134 deletions.
112 changes: 54 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
name: CI

on:
pull_request:
push:
branches:
- master
tags:
- 'v*.*.*'
pull_request:
push:
branches:
- master
tags:
- 'v*.*.*'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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

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

- name: Setup NodeJS
uses: actions/setup-node@v2
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

# TODO: Have working unit tests generated
# - name: Run Unit Tests
# run: |
# npm run test

# Integration tests, first docker compose up runs the normal test.
# The second one runs the test without deleting the FaaS container,
# and the environment varialbe TEST_FAAS_STARTUP_DEPLOY forces the
# test to avoid deploying again all the deployments. By this we are
# testing if the startup initialization works because the deployments
# are persisted from the previous run.
- name: Run Integration Tests
shell: bash
run: |
docker compose build
docker compose up --exit-code-from test
TEST_FAAS_STARTUP_DEPLOY=true docker compose up --exit-code-from test
docker compose down
- name: Publish
uses: JS-DevTools/npm-publish@v1
if: startsWith(github.ref, 'refs/tags/')
with:
access: 'public'
token: ${{ secrets.NPM_AUTH_TOKEN }}
ci:
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:
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

# TODO: Have working unit tests generated
# - name: Run Unit Tests
# run: |
# npm run test

- name: Run Integration Tests
shell: bash
run: ./test.sh

- name: Publish
uses: JS-DevTools/npm-publish@v3
if: startsWith(github.ref, 'refs/tags/')
with:
access: 'public'
token: ${{ secrets.NPM_AUTH_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: DockerHub

on:
push:
branches:
- master
tags:
- 'v*.*.*'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
IMAGE_NAME: index.docker.io/metacall/faas

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

- name: Run Integration Tests
shell: bash
run: ./test.sh

- name: Login to DockerHub
run: docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" -p "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}"

- name: Push MetaCall FaaS Docker Image to DockerHub
run: |
docker tag metacall/faas ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:latest
if [[ "${{ contains(github.ref, 'refs/tags/') }}" = true ]]; then
TAG=${GITHUB_REF#refs/*/}
VERSION=${TAG#v}
docker tag metacall/faas ${{ env.IMAGE_NAME }}:${VERSION}
docker push ${{ env.IMAGE_NAME }}:${VERSION}
fi
- name: Logout from DockerHub
run: docker logout
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN npm install \
FROM base as faas

RUN apt-get update \
&& apt-get install wget ca-certificates -y --no-install-recommends \
&& apt-get install wget ca-certificates git -y --no-install-recommends \
&& wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | sh

COPY --from=deps /metacall/node_modules node_modules
Expand All @@ -52,5 +52,5 @@ CMD ["node", "dist/index.js"]
FROM base AS test

RUN apt-get update \
&& apt-get install curl ca-certificates jq -y --no-install-recommends \
&& apt-get install curl ca-certificates jq git expect -y --no-install-recommends \
&& npm install -g @metacall/deploy
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ services:
target: faas
ports:
- "9000:9000"
volumes:
- ./logs:/metacall/logs

test:
image: metacall/faas:test
Expand All @@ -39,7 +41,6 @@ services:
target: test
environment:
TEST_FAAS_STARTUP_DEPLOY: ${TEST_FAAS_STARTUP_DEPLOY:-false}
TEST_FAAS_DEPENDENCY_DEPLOY: ${TEST_FAAS_DEPENDENCY_DEPLOY:-true}
network_mode: host
depends_on:
- faas
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "@metacall/faas",
"version": "0.1.0",
"version": "0.1.2",
"description": "Reimplementation of MetaCall FaaS platform written in TypeScript.",
"main": "dist/index.js",
"bin": {
"metacall-faas": "dist/index.js"
},
"scripts": {
"test": "npm run build && mocha dist/test",
"prepublishOnly": "npm run build",
Expand Down Expand Up @@ -86,7 +89,23 @@
"caughtErrorsIgnorePattern": "^_"
}
]
}
},
"overrides": [
{
"files": [
"*.js"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unsafe-return": "off"
}
}
]
},
"dependencies": {
"@metacall/protocol": "^0.1.26",
Expand Down
2 changes: 1 addition & 1 deletion src/controller/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const inspect = (_req: Request, res: Response): Response => {
if (!application.deployment.packages) {
throw new Error('Packages is undefined or null');
}
deployments.push(application.deployment);
deployments.unshift(application.deployment);
}
}

Expand Down
Loading

0 comments on commit c5a250e

Please sign in to comment.