mirror of
https://github.com/plankanban/planka.git
synced 2025-08-04 13:05:24 +02:00
refactor ci
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
This commit is contained in:
parent
8b1a599bee
commit
a4d8cdb14d
4 changed files with 97 additions and 92 deletions
73
.github/workflows/build-and-test.yml
vendored
Normal file
73
.github/workflows/build-and-test.yml
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: planka_db
|
||||||
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Setup PostgreSQL
|
||||||
|
uses: ikalnytskyi/action-setup-postgres@v5
|
||||||
|
with:
|
||||||
|
database: ${{ env.POSTGRES_DB }}
|
||||||
|
username: ${{ env.POSTGRES_USER }}
|
||||||
|
password: ${{ env.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Cache Node.js modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: client/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
cd client
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: server setup
|
||||||
|
env:
|
||||||
|
DEFAULT_ADMIN_EMAIL: demo@demo.demo
|
||||||
|
DEFAULT_ADMIN_PASSWORD: demo
|
||||||
|
DEFAULT_ADMIN_NAME: Demo Demo
|
||||||
|
DEFAULT_ADMIN_USERNAME: demo
|
||||||
|
run: |
|
||||||
|
client/tests/setup-symlinks.sh
|
||||||
|
cd server
|
||||||
|
cp .env.sample .env
|
||||||
|
sed -i "s|^DATABASE_URL=.*|DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost/${POSTGRES_DB}|" .env
|
||||||
|
npm run db:init
|
||||||
|
npm start --prod &
|
||||||
|
|
||||||
|
- name: Wait for development server
|
||||||
|
run: |
|
||||||
|
sudo apt-get install wait-for-it -y
|
||||||
|
wait-for-it -h localhost -p 1337 -t 10
|
||||||
|
|
||||||
|
- name: Run UI tests
|
||||||
|
run: |
|
||||||
|
cd client
|
||||||
|
npm install
|
||||||
|
npx playwright install chromium
|
||||||
|
npm run test:acceptance tests
|
91
.github/workflows/ci-workflows.yml
vendored
91
.github/workflows/ci-workflows.yml
vendored
|
@ -1,91 +0,0 @@
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
setup:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: Setup PostgreSQL
|
|
||||||
uses: ikalnytskyi/action-setup-postgres@v5
|
|
||||||
with:
|
|
||||||
port: 5432
|
|
||||||
database: planka
|
|
||||||
username: planka
|
|
||||||
password: planka
|
|
||||||
|
|
||||||
- name: Cache Node.js modules
|
|
||||||
id: cache-npm
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/home/runner/work/planka/planka/node_modules
|
|
||||||
/home/runner/work/planka/planka/client/node_modules
|
|
||||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node_modules-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
cd client
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
- name: Save Node.js modules cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/home/runner/work/planka/planka/node_modules
|
|
||||||
/home/runner/work/planka/planka/client/node_modules
|
|
||||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Symbolic fun
|
|
||||||
run: |
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/asset-manifest.json /home/runner/work/planka/planka/server/public/asset-manifest.json
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/favicon.ico /home/runner/work/planka/planka/server/public/favicon.ico
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/logo192.png /home/runner/work/planka/planka/server/public/logo192.png
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/logo512.png /home/runner/work/planka/planka/server/public/logo512.png
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/manifest.json /home/runner/work/planka/planka/server/public/manifest.json
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/robots.txt /home/runner/work/planka/planka/server/public/robots.txt
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/static /home/runner/work/planka/planka/server/public/static
|
|
||||||
ln -s /home/runner/work/planka/planka/client/build/index.html /home/runner/work/planka/planka/server/views/index.ejs
|
|
||||||
|
|
||||||
- name: server setup
|
|
||||||
run: |
|
|
||||||
SECRETKEY=$(openssl rand -hex 64)
|
|
||||||
cd server
|
|
||||||
cp .env.sample .env
|
|
||||||
sed -i 's|^DATABASE_URL=.*|DATABASE_URL=postgresql://planka:planka@localhost/planka|' .env
|
|
||||||
sed -i "s|^SECRET_KEY=.*|SECRET_KEY=${SECRETKEY}/|" .env
|
|
||||||
sed -i 's/^# DEFAULT_ADMIN_EMAIL/DEFAULT_ADMIN_EMAIL/' .env
|
|
||||||
sed -i 's/^# DEFAULT_ADMIN_PASSWORD/DEFAULT_ADMIN_PASSWORD/' .env
|
|
||||||
sed -i 's/^# DEFAULT_ADMIN_NAME/DEFAULT_ADMIN_NAME/' .env
|
|
||||||
sed -i 's/^# DEFAULT_ADMIN_USERNAME/DEFAULT_ADMIN_USERNAME/' .env
|
|
||||||
npm run db:init
|
|
||||||
npm start --prod &
|
|
||||||
|
|
||||||
- name: Wait for development server
|
|
||||||
run: |
|
|
||||||
sudo apt-get install wait-for-it -y
|
|
||||||
wait-for-it -h localhost -p 1337 -t 10
|
|
||||||
|
|
||||||
- name: Run e2e tests
|
|
||||||
run: |
|
|
||||||
cd client
|
|
||||||
npm install
|
|
||||||
npx playwright install chromium
|
|
||||||
npm run test:e2e tests
|
|
|
@ -7,7 +7,7 @@
|
||||||
"lint": "eslint --ext js,jsx src config-overrides.js",
|
"lint": "eslint --ext js,jsx src config-overrides.js",
|
||||||
"start": "react-app-rewired start",
|
"start": "react-app-rewired start",
|
||||||
"test": "react-app-rewired test",
|
"test": "react-app-rewired test",
|
||||||
"test:e2e": "cucumber-js --require cucumber.conf.js --require tests/acceptance/stepDefinitions/**/*.js --format @cucumber/pretty-formatter"
|
"test:acceptance": "cucumber-js --require cucumber.conf.js --require tests/acceptance/stepDefinitions/**/*.js --format @cucumber/pretty-formatter"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|
23
client/tests/setup-symlinks.sh
Executable file
23
client/tests/setup-symlinks.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script sets up symbolic links between the client build files and the server directories,
|
||||||
|
|
||||||
|
# Navigate to the root directory of the git repository
|
||||||
|
cd "$(git rev-parse --show-toplevel)" || { echo "Failed to navigate to the git repository root"; exit 1; }
|
||||||
|
|
||||||
|
# Store paths for the client build, server public directory, and server views directory
|
||||||
|
CLIENT_PATH=$(pwd)/client/build
|
||||||
|
SERVER_PUBLIC_PATH=$(pwd)/server/public
|
||||||
|
SERVER_VIEWS_PATH=$(pwd)/server/views
|
||||||
|
|
||||||
|
# Create symbolic links for the necessary client assets in the server's public and views directories
|
||||||
|
ln -s ${CLIENT_PATH}/asset-manifest.json ${SERVER_PUBLIC_PATH}/asset-manifest.json && echo "Linked asset-manifest.json successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/favicon.ico ${SERVER_PUBLIC_PATH}/favicon.ico && echo "Linked favicon.ico successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/logo192.png ${SERVER_PUBLIC_PATH}/logo192.png && echo "Linked logo192.png successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/logo512.png ${SERVER_PUBLIC_PATH}/logo512.png && echo "Linked logo512.png successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/manifest.json ${SERVER_PUBLIC_PATH}/manifest.json && echo "Linked manifest.json successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/robots.txt ${SERVER_PUBLIC_PATH}/robots.txt && echo "Linked robots.txt successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/static ${SERVER_PUBLIC_PATH}/static && echo "Linked static folder successfully"
|
||||||
|
ln -s ${CLIENT_PATH}/index.html ${SERVER_VIEWS_PATH}/index.ejs && echo "Linked index.html to index.ejs successfully"
|
||||||
|
|
||||||
|
echo "Setup symbolic links completed successfully."
|
Loading…
Add table
Add a link
Reference in a new issue