Skip to content

change name and tidy up #135

change name and tidy up

change name and tidy up #135

Workflow file for this run

name: Node CI and Release
on:
push:
branches:
- '**'
tags:
- '*'
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-20.04
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Run linting checks
run: |
cd types && npm ci --loglevel=error && npm run lint && cd ..
cd browse && npm ci --loglevel=error && npm run lint && cd ..
cd api && npm ci --loglevel=error && npm run lint && cd ..
cd integration-tests && npm ci --loglevel=error && npm run lint && cd ..
test:
runs-on: ubuntu-20.04
strategy:
matrix:
batch: [ci-batch-1, ci-batch-2]
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2375:2375
env:
DOCKER_TLS_CERTDIR: ""
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Verify installation
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Set up Docker environment
run: |
docker-compose build
docker-compose up --force-recreate &> dockerstart.log &
node ./api/waitForApi.js || { docker ps; docker-compose logs; exit 1; }
- name: Apply migration undo and redo to test undo migration
run: |
docker-compose exec server /app/api/node_modules/.bin/sequelize db:migrate:undo --config /app/api/config/app_test_default.js --migrations-path /app/api/migrations
docker-compose exec server /app/api/node_modules/.bin/sequelize db:migrate --config /app/api/config/app_test_default.js --migrations-path /app/api/migrations
- name: Run Cypress tests
env:
BATCH: ${{ matrix.batch }}
run: |
cd integration-tests
npm ci --loglevel=error
npm run $BATCH
build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install global npm packages
run: npm install -g --loglevel=error npm json [email protected]
- name: Generate API docs
run: |
cd api
npm update --loglevel=error apidoc-plugin-ts
npm run apidoc
- name: Prepare for deployment
run: |
version=${GITHUB_REF#refs/tags/v}
mkdir /tmp/nfpm
curl -sL https://github.com/goreleaser/nfpm/releases/download/v0.9.5/nfpm_0.9.5_Linux_x86_64.tar.gz | tar -C /tmp/nfpm -xzf -
export PATH=/tmp/nfpm:$PATH
_release/build.sh ${version}
- name: Upload release assets
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.deb"
allowUpdates: true