diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..bbf3b92 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,74 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "master", "TrivediHeena-patch-2" ] + pull_request: + branches: [ "master", "TrivediHeena-patch-2" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x] + couchdb: [3.1] + #couchdb: ["3.1", "3.0", "2.3"] + #node-version: [10.x, 14.x, 16.x, 18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + - name: Start CouchDB + uses: iamssen/couchdb-github-action@master + with: + couchdb-version: ${{ matrix.couchdb }} + #- name: Install Dependencies + # run: npm install + # - name: Linting Files + # run: npm run lint + - name: Build Bundle + run: | + npm install -g node-gyp + npm install socket.io + npm ci + npm run build --if-present + - name: Test endpoint + run: | + curl -f http://127.0.0.1:5984/ + + - name: Test auth + run: | + curl -X POST -H "Content-Type: application/json; charset=utf-8" -d '{"name": "admin", "password": "password"}' http://127.0.0.1:5984/_session + + - name: Testing Bundle + working-directory: ./test + run: | + CI=true npm run test-types + # #curl -f http://127.0.0.1:9876/ + + deploy: + needs: + - build + # - test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x] + couchdb: [3.1] + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag pouchdb_auth:$(date +%s) + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a90d8bd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM node:10-alpine +WORKDIR /pouchdb-authentication/ +RUN npm install +COPY . .