Compare commits
20 Commits
897a668637
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 19208e00fe | |||
| 527285a487 | |||
| 2aef815c81 | |||
| ed25b0e8ba | |||
| 9c71629910 | |||
| ab20b9a621 | |||
| ab3f5cfbbf | |||
| 81724cb20d | |||
| 4098ade419 | |||
| 232682671f | |||
| 867624df97 | |||
| 200da771cd | |||
| db2a168f4b | |||
| 62737151ee | |||
| 5565db4d8c | |||
| 190ecbe521 | |||
| 94c14f3e1d | |||
| 8184ffecf4 | |||
| edfca1f007 | |||
| d752df1c15 |
76
.gitea/actions/init-db/action.yaml
Normal file
76
.gitea/actions/init-db/action.yaml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: initialize database
|
||||||
|
description: initialize database by using database of test environment
|
||||||
|
author: BinKrassDuFass
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
MONGODB_SERVICE_NAME:
|
||||||
|
description: 'Name of the MongoDB service'
|
||||||
|
required: true
|
||||||
|
default: 'mongo'
|
||||||
|
|
||||||
|
TIBI_USERNAME:
|
||||||
|
description: 'Username of the Tibi account'
|
||||||
|
required: true
|
||||||
|
default: 'admin'
|
||||||
|
|
||||||
|
TIBI_PASSWORD:
|
||||||
|
description: 'Password of the Tibi account'
|
||||||
|
required: true
|
||||||
|
default: 'admin'
|
||||||
|
|
||||||
|
TIBI_API_URL:
|
||||||
|
description: 'URL of the Tibi API'
|
||||||
|
required: true
|
||||||
|
default: 'http://tibi-server:8080/api/v1'
|
||||||
|
|
||||||
|
TIBI_API_CONFIG_PATH:
|
||||||
|
description: 'Path of the Tibi API config'
|
||||||
|
required: true
|
||||||
|
default: "${{github.workspace}}/api/config.yml}}"
|
||||||
|
|
||||||
|
TIBI_API_NAMESPACE:
|
||||||
|
description: 'Namespace of the Tibi API'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
PROJECT_NAME:
|
||||||
|
description: 'Name of the project'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Setup mongo tools
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "::group::setup Mongo keys"
|
||||||
|
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
|
||||||
|
sudo apt-get install -y gnupg
|
||||||
|
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
|
||||||
|
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "::group::mongodb tools"
|
||||||
|
sudo apt-get update
|
||||||
|
echo "aptitude install mongodb-database-tools"
|
||||||
|
sudo apt-get install -y mongodb-database-tools
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "mongodump --version"
|
||||||
|
mongodump --version
|
||||||
|
|
||||||
|
- name: Restore MongoDB Data
|
||||||
|
run: |
|
||||||
|
echo "::group::initialize mongo data"
|
||||||
|
mongorestore --uri "mongodb://${{inputs.MONGODB_SERVICE_NAME}}:27017" ./.github/actions/init-db/mongo-dump
|
||||||
|
echo "::endgroup::"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: set config in tibi
|
||||||
|
shell: bash
|
||||||
|
run: ./.github/actions/init-db/setConfigInTibiProject.sh ${{inputs.TIBI_USERNAME}} ${{inputs.TIBI_PASSWORD}} ${{inputs.TIBI_API_URL}} ${{inputs.TIBI_API_CONFIG_PATH}} ${{inputs.TIBI_API_NAMESPACE}} ${{inputs.PROJECT_NAME}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
name: initialize database
|
|
||||||
description: initialize database by using database of test environment
|
|
||||||
author: BinKrassDuFass
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
MONGODB_SERVICE_NAME:
|
|
||||||
description: 'Name of the MongoDB service'
|
|
||||||
required: true
|
|
||||||
default: 'mongo'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- name: Install MongoDB tools
|
|
||||||
run: sudo apt-get install -y mongodb-database-tools
|
|
||||||
|
|
||||||
- name: Restore MongoDB Data
|
|
||||||
run: mongorestore --uri "mongodb://${{inputs.MONGODB_SERVICE_NAME}}:27017" /.gitea/
|
|
||||||
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
const axios = require("axios")
|
|
||||||
const { MongoClient } = require("mongodb")
|
|
||||||
const fs = require("fs")
|
|
||||||
const util = require("util")
|
|
||||||
|
|
||||||
// Function to log objects in a detailed manner
|
|
||||||
function logObj(o) {
|
|
||||||
console.log(util.inspect(o, false, null, true))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to preload the database with collections
|
|
||||||
async function preloadDatabase(db, collections) {
|
|
||||||
for (const { name, file } of collections) {
|
|
||||||
const content = fs.readFileSync(file, "utf8")
|
|
||||||
const data = JSON.parse(content)
|
|
||||||
|
|
||||||
const collection = db.collection(name)
|
|
||||||
await collection.insertMany(data)
|
|
||||||
|
|
||||||
const insertedData = await collection.find({}).toArray()
|
|
||||||
if (insertedData.length !== data.length) {
|
|
||||||
console.error(
|
|
||||||
`Mismatch in collection ${name}: expected ${data.length} documents, found ${insertedData.length}`
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
console.log(`Successfully verified ${insertedData.length} documents in ${name}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function initializeDatabase(config) {
|
|
||||||
try {
|
|
||||||
const dbClient = new MongoClient(config.mongodbUri)
|
|
||||||
await dbClient.connect()
|
|
||||||
let db = dbClient.db(config.tibiDbPrefix)
|
|
||||||
await db.collection("project").deleteMany({ namespace: config.projectApiNamespace })
|
|
||||||
|
|
||||||
const dbName = config.tibiDbPrefix + "_" + config.projectApiNamespace
|
|
||||||
db = dbClient.db(dbName)
|
|
||||||
await db.dropDatabase()
|
|
||||||
|
|
||||||
// Login to Tibi API
|
|
||||||
const loginResponse = await axios.post(config.tibiApiUrl + "/login", {
|
|
||||||
username: config.tibiUsername,
|
|
||||||
password: config.tibiPassword,
|
|
||||||
})
|
|
||||||
const tibiToken = loginResponse.data.token
|
|
||||||
|
|
||||||
// Create project
|
|
||||||
let project
|
|
||||||
try {
|
|
||||||
const projectResponse = await axios.post(
|
|
||||||
config.tibiApiUrl + "/project",
|
|
||||||
{
|
|
||||||
configFile: config.projectApiConfig,
|
|
||||||
name: config.projectApiNamespace,
|
|
||||||
namespace: config.projectApiNamespace,
|
|
||||||
description: config.projectApiNamespace,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"X-Auth-Token": tibiToken,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
project = projectResponse.data
|
|
||||||
} catch (e) {
|
|
||||||
logObj(e)
|
|
||||||
throw e
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if project is online
|
|
||||||
const projectStatus = await axios.get(config.tibiApiUrl + "/project/" + project.id, {
|
|
||||||
headers: {
|
|
||||||
"X-Auth-Token": tibiToken,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if (!projectStatus.data.api.isOnline) {
|
|
||||||
throw new Error(`Project ${config.projectApiNamespace} is not online.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Define collections to preload into the database
|
|
||||||
const collections = [
|
|
||||||
// Define your collections here as per your Cypress plugin logic
|
|
||||||
// { name: "collectionName", file: "path/to/file.json" },
|
|
||||||
// ... other collections
|
|
||||||
]
|
|
||||||
await preloadDatabase(db, collections)
|
|
||||||
|
|
||||||
await dbClient.close()
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error initializing the database:", error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run the script if it's executed directly
|
|
||||||
if (require.main === module) {
|
|
||||||
const config = {
|
|
||||||
projectApiNamespace: process.env.PROJECT_API_NAMESPACE,
|
|
||||||
mongodbUri: process.env.MONGODB_URI,
|
|
||||||
tibiDbPrefix: process.env.TIBI_DB_PREFIX,
|
|
||||||
tibiApiUrl: process.env.TIBI_API_URL,
|
|
||||||
// Add other required environment variables here
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeDatabase(config)
|
|
||||||
.then(() => console.log("Database initialized successfully"))
|
|
||||||
.catch((err) => {
|
|
||||||
console.error("Failed to initialize database:", err)
|
|
||||||
process.exit(1)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = initializeDatabase
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.lighthouse"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.lighthouse"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.lighthouse"}],"uuid":"fca0bbd4089a43689609593178154de9"}
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.lighthouseSubpath"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.lighthouseSubpath"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.lighthouseSubpath"}],"uuid":"b72120ec4cd34054a83833dce78c869f"}
|
||||||
Binary file not shown.
108
.gitea/actions/init-db/setConfigInTibiProject.sh
Normal file
108
.gitea/actions/init-db/setConfigInTibiProject.sh
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Start a GitHub Actions group for input validation
|
||||||
|
echo "::group::Validating Inputs"
|
||||||
|
|
||||||
|
# Check if the correct number of arguments is passed
|
||||||
|
if [ "$#" -ne 6 ]; then
|
||||||
|
echo "Incorrect number of arguments provided."
|
||||||
|
echo "Usage: $0 <TIBI_USERNAME> <TIBI_PASSWORD> <TIBI_API_URL> <PROJECT_API_CONFIG> <PROJECT_NAMESPACE> <PROJECT_NAME>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assigning passed arguments to variables for better readability
|
||||||
|
TIBI_USERNAME=$1
|
||||||
|
TIBI_PASSWORD=$2
|
||||||
|
TIBI_API_URL=$3
|
||||||
|
PROJECT_API_CONFIG=$4
|
||||||
|
PROJECT_NAMESPACE=$5
|
||||||
|
PROJECT_NAME=$6
|
||||||
|
|
||||||
|
echo "Provided TIBI_USERNAME: $TIBI_USERNAME"
|
||||||
|
echo "TIBI_API_URL: $TIBI_API_URL"
|
||||||
|
# Be cautious with logging sensitive data like passwords and tokens
|
||||||
|
# Echoing the password or sensitive information is generally not recommended
|
||||||
|
|
||||||
|
# End the input validation group
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Start a group for authentication
|
||||||
|
echo "::group::Authenticating User"
|
||||||
|
|
||||||
|
# Prepare authentication request payload
|
||||||
|
auth_payload=$(jq -n --arg username "$TIBI_USERNAME" --arg password "$TIBI_PASSWORD" '{username: $username, password: $password}')
|
||||||
|
echo "Authentication payload: $auth_payload"
|
||||||
|
# Fetch the authentication token
|
||||||
|
echo "Requesting authentication token..."
|
||||||
|
auth_response=$(curl -s -X POST -H "Content-Type: application/json" -d "$auth_payload" "$TIBI_API_URL/login")
|
||||||
|
# Logging the response for debugging (remove sensitive data as necessary)
|
||||||
|
echo "Authentication response: $auth_response"
|
||||||
|
|
||||||
|
# Extract token from the response
|
||||||
|
TIBI_AUTH_TOKEN=$(echo $auth_response | jq -r '.token')
|
||||||
|
|
||||||
|
# Check if the token was successfully retrieved
|
||||||
|
if [ -z "$TIBI_AUTH_TOKEN" ]; then
|
||||||
|
echo "Failed to get authentication token. Exiting script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Authentication token received successfully."
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Start a group for fetching project data
|
||||||
|
echo "::group::Fetching Project Data"
|
||||||
|
|
||||||
|
# Get the list of projects from the API
|
||||||
|
echo "Retrieving projects..."
|
||||||
|
response=$(curl -s -H "X-Auth-Token: $TIBI_AUTH_TOKEN" "$TIBI_API_URL/project")
|
||||||
|
echo $response
|
||||||
|
projects=$(echo $response) # Parse the JSON response to get project data
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Start a group for processing project data
|
||||||
|
echo "::group::Processing Project Data"
|
||||||
|
|
||||||
|
# Initialize variables to track project existence
|
||||||
|
projectFound=false
|
||||||
|
projectId=""
|
||||||
|
|
||||||
|
# Loop through each project to find if the required project exists
|
||||||
|
for row in $(echo "${projects}" | jq -r '.[] | @base64'); do
|
||||||
|
_jq() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
api_name=$(_jq '.name')
|
||||||
|
# Check if the current project's namespace matches the target
|
||||||
|
if [ "$api_name" == "$PROJECT_NAME" ]; then
|
||||||
|
projectId=$(_jq '.id')
|
||||||
|
projectData=$(echo ${row} | base64 --decode)
|
||||||
|
projectFound=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Start a group for creating or updating the project
|
||||||
|
echo "::group::Creating or Updating Project"
|
||||||
|
|
||||||
|
# Conditionally create a new project or update the existing one
|
||||||
|
if [ "$projectFound" = true ]; then
|
||||||
|
echo "Project found with ID: $projectId, updating..."
|
||||||
|
# Prepare updated project data
|
||||||
|
updatedProjectData=$(echo $projectData | jq --arg configFile "$PROJECT_API_CONFIG" '.configFile = $configFile | del(.id)')
|
||||||
|
# Send a PUT request to update the project
|
||||||
|
updateResponse=$(curl -s -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: $TIBI_AUTH_TOKEN" -d "$updatedProjectData" "$TIBI_API_URL/project/$projectId")
|
||||||
|
# Logging the response for debugging (remove sensitive data as necessary)
|
||||||
|
echo "Update response: $updateResponse"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Project not found. Creating new project..."
|
||||||
|
# Send a POST request to create a new project
|
||||||
|
createResponse=$(curl -s -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $TIBI_AUTH_TOKEN" -d "{\"configFile\":\"$PROJECT_API_CONFIG\", \"name\":\"$PROJECT_NAMESPACE\", \"namespace\":\"$PROJECT_NAMESPACE\", \"description\":\"$PROJECT_NAMESPACE\"}" "$TIBI_API_URL/project")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
@@ -139,6 +139,7 @@ jobs:
|
|||||||
docker logs $container_id || true
|
docker logs $container_id || true
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
done
|
done
|
||||||
|
|
||||||
#- name: Wait for Live Server
|
#- name: Wait for Live Server
|
||||||
# run: |
|
# run: |
|
||||||
# attempts=0
|
# attempts=0
|
||||||
@@ -186,16 +187,13 @@ jobs:
|
|||||||
yarn add lighthouse
|
yarn add lighthouse
|
||||||
npx lighthouse http://live-server:80 --output json --output-path /tmp/lighthouse-report.json --chrome-flags="--headless --no-sandbox --disable-dev-shm-usage"
|
npx lighthouse http://live-server:80 --output json --output-path /tmp/lighthouse-report.json --chrome-flags="--headless --no-sandbox --disable-dev-shm-usage"
|
||||||
|
|
||||||
# Notify-Lighthouse Step
|
- name: upload-to-nextcloud
|
||||||
- name: Notify Lighthouse
|
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
sudo apt-get update && sudo apt-get install -y curl bash findutils
|
||||||
-e PLUGIN_FROM=noreply@gitbase.de \
|
export datetime=`date +%Y-%m-%d_%H-%M-%S`
|
||||||
-e PLUGIN_HOST=smtp.basehosts.de \
|
mkdir -p /tmp/cloudsend/${GITHUB_REF_NAME}/$${datetime}
|
||||||
-e PLUGIN_RECIPIENT=binkrassdufass@gmail.com \
|
mv /tmp/lighthouse-report.json /tmp/cloudsend/${GITHUB_REF_NAME}/$${datetime}/
|
||||||
-e PLUGIN_SUBJECT="Lighthouse Report" \
|
./scripts/cloudsend.sh /tmp/cloudsend/ https://www.basiswolke.de/index.php/s/xHGsypbqiifnGH5
|
||||||
-v ${{ github.workspace }}/tmp:/lighthouse-reports \
|
|
||||||
drillster/drone-email /tmp/lighthouse-report.json
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: deploy
|
name: deploy
|
||||||
@@ -205,64 +203,23 @@ jobs:
|
|||||||
volumes:
|
volumes:
|
||||||
- /data:/data
|
- /data:/data
|
||||||
|
|
||||||
services:
|
|
||||||
mongo:
|
|
||||||
image: mongo:4.2
|
|
||||||
ports:
|
|
||||||
- 27017:27017
|
|
||||||
|
|
||||||
maildev:
|
|
||||||
image: gitbase.de/robin/maildev:latest
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
- 25:25
|
|
||||||
|
|
||||||
tibi-server:
|
|
||||||
image: gitbase.de/cms/tibi-server
|
|
||||||
ports:
|
|
||||||
- 8080:8080
|
|
||||||
env:
|
|
||||||
DB_DIAL: mongodb://mongo
|
|
||||||
API_PORT: 8080
|
|
||||||
MAIL_HOST: maildev:25
|
|
||||||
SECURITY_ALLOWABSOLUTEPATHS: "true"
|
|
||||||
SECURITY_ALLOWUPPERPATHS: "true"
|
|
||||||
SECURITY_ALLOWRELATIVEPATHS: "true"
|
|
||||||
|
|
||||||
live-server:
|
|
||||||
image: gitbase.de/robin/live-server:latest
|
|
||||||
ports:
|
|
||||||
- 8081:8081
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
lfs: true
|
||||||
|
submodules: true
|
||||||
|
|
||||||
- name: setup node 18
|
- run: |
|
||||||
|
git fetch --force --tags
|
||||||
|
|
||||||
|
# setup node 20
|
||||||
|
- name: setup node 20
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
|
||||||
- name: container within a step
|
|
||||||
uses: docker://node:20-alpine3.19
|
|
||||||
with:
|
with:
|
||||||
entrypoint: echo
|
node-version: 20
|
||||||
args: "dastest"
|
|
||||||
- name: check docker networking infos
|
|
||||||
run: |
|
|
||||||
echo "${{ toJson(job) }}"
|
|
||||||
echo "${{ github }}"
|
|
||||||
docker network ls
|
|
||||||
docker network inspect bridge
|
|
||||||
docker network inspect host
|
|
||||||
docker network inspect none
|
|
||||||
docker network inspect container:${{ job.services.tibi-server.id }}
|
|
||||||
docker network inspect container:${{ job.services.live-server.id }}
|
|
||||||
docker network inspect container:${{ job.services.mongo.id }}
|
|
||||||
docker network inspect container:${{ job.services.maildev.id }}
|
|
||||||
|
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
env:
|
|
||||||
FORCE_COLOR: "true"
|
|
||||||
run: |
|
run: |
|
||||||
npm install -g yarn
|
npm install -g yarn
|
||||||
yarn install
|
yarn install
|
||||||
@@ -271,13 +228,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sed -i 's#\(sentryEnvironment.*\)".*"#\1"${GITHUB_REF_NAME}"#g' frontend/src/config.ts
|
sed -i 's#\(sentryEnvironment.*\)".*"#\1"${GITHUB_REF_NAME}"#g' frontend/src/config.ts
|
||||||
sed -i 's#//\( sentry\\.init.*\)#\1#g' frontend/src/config.ts
|
sed -i 's#//\( sentry\\.init.*\)#\1#g' frontend/src/config.ts
|
||||||
export $(cat .env | xargs)
|
set -o allexport
|
||||||
echo "PROJECT_RELEASE=${RELEASE_PROJECT_SLUG}.r`git rev-list HEAD --count`-`git describe --all --long | sed 's+/+-+'`" >> .env
|
. ./.env
|
||||||
export $(cat .env | xargs)
|
echo "PROJECT_RELEASE=${SENTRY_PROJECT}.r`git rev-list HEAD --count`-`git describe --all --long | sed 's+/+-+'`" >> .env
|
||||||
|
. ./.env
|
||||||
|
set +o allexport
|
||||||
echo ______ .env ______
|
echo ______ .env ______
|
||||||
cat .env
|
cat .env
|
||||||
echo
|
echo
|
||||||
sed -i 's#\(const release = \).*#\1"'${PROJECT_RELEASE}'"#g' api/hooks/config-client.js
|
sed -i 's#\(const release = \).*#\1"'${PROJECT_RELEASE}'"#g' api/hooks/config-client.js
|
||||||
|
sed -i 's#\(const originURL = \).*#\1"'${LIVE_URL}'"#g' api/hooks/config-client.js
|
||||||
|
|
||||||
# bash scripts/preload-meta.sh frontend/spa.html
|
# bash scripts/preload-meta.sh frontend/spa.html
|
||||||
# bash scripts/preload-meta.sh frontend/spa.html > frontend/_spa.html
|
# bash scripts/preload-meta.sh frontend/spa.html > frontend/_spa.html
|
||||||
@@ -287,11 +247,15 @@ jobs:
|
|||||||
sed -i s/__TIMESTAMP__/$stamp/g frontend/spa.html
|
sed -i s/__TIMESTAMP__/$stamp/g frontend/spa.html
|
||||||
# sed -i s/__TIMESTAMP__/$stamp/g frontend/serviceworker.js
|
# sed -i s/__TIMESTAMP__/$stamp/g frontend/serviceworker.js
|
||||||
# cat frontend/serviceworker.js
|
# cat frontend/serviceworker.js
|
||||||
# rm api/templates/spa.html
|
rm api/templates/spa.html
|
||||||
# cp frontend/spa.html api/templates/spa.html
|
cp frontend/spa.html api/templates/spa.html
|
||||||
echo ______ frontend/spa.html ______
|
echo ______ frontend/spa.html ______
|
||||||
cat frontend/spa.html
|
cat frontend/spa.html
|
||||||
|
|
||||||
|
# sed -i 's#\(PREVIEW_URL=\).*#\1'${LIVE_URL}/preview'#g' api/config.yml.env
|
||||||
|
echo ______ api/config.yml.env ______
|
||||||
|
cat api/config.yml.env
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: "true"
|
FORCE_COLOR: "true"
|
||||||
@@ -310,58 +274,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
yarn build:legacy
|
yarn build:legacy
|
||||||
|
|
||||||
- name: Wait for Live Server
|
|
||||||
run: |
|
|
||||||
attempts=0
|
|
||||||
max_attempts=2
|
|
||||||
while ! curl --output /dev/null --silent --head --fail http://live-server:8081; do
|
|
||||||
if [ $attempts -eq $max_attempts ]; then
|
|
||||||
echo "Live server not ready after $max_attempts attempts"
|
|
||||||
echo "${{ toJson(job) }}"
|
|
||||||
curl -v http://live-server:8081
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
attempts=$((attempts+1))
|
|
||||||
echo "Waiting for live-server to be ready... attempt $attempts"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Test HTTP Request
|
|
||||||
run: |
|
|
||||||
echo "Live server not ready after $max_attempts attempts"
|
|
||||||
echo "${{ toJson(job) }}"
|
|
||||||
echo "${{ job.services.live-server.id }}"
|
|
||||||
echo "${{ job.services.tibi-server.id }}"
|
|
||||||
echo "${{ job.services.mongo.id }}"
|
|
||||||
docker logs "${{ job.services.tibi-server.id }}"
|
|
||||||
docker logs "${{ job.services.live-server.id }}"
|
|
||||||
curl -v http://live-server:8081
|
|
||||||
|
|
||||||
- name: Install Chrome
|
|
||||||
run: |
|
|
||||||
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
|
||||||
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y google-chrome-stable
|
|
||||||
|
|
||||||
# Lighthouse Analysis Step
|
|
||||||
- name: Lighthouse Analysis
|
|
||||||
run: |
|
|
||||||
yarn add lighthouse
|
|
||||||
npx lighthouse http://127.0.0.1:8081 --output json --output-path /tmp/lighthouse-report.json --chrome-flags="--headless --no-sandbox --disable-dev-shm-usage"
|
|
||||||
|
|
||||||
# Notify-Lighthouse Step
|
|
||||||
- name: Notify Lighthouse
|
|
||||||
run: |
|
|
||||||
docker run --rm \
|
|
||||||
-e PLUGIN_FROM=noreply@gitbase.de \
|
|
||||||
-e PLUGIN_HOST=smtp.basehosts.de \
|
|
||||||
-e PLUGIN_RECIPIENT=recipient@example.com \
|
|
||||||
-e PLUGIN_SUBJECT="Lighthouse Report" \
|
|
||||||
-v ${{ github.workspace }}/tmp:/lighthouse-reports \
|
|
||||||
drillster/drone-email /tmp/lighthouse-report.json
|
|
||||||
|
|
||||||
- name: deploy
|
- name: deploy
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
env:
|
env:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/b4a-npm-1.6.4-080bcba845-81b086f9af.zip
vendored
BIN
.yarn/cache/b4a-npm-1.6.4-080bcba845-81b086f9af.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/ip-npm-1.1.8-abea558b72-a2ade53eb3.zip
vendored
BIN
.yarn/cache/ip-npm-1.1.8-abea558b72-a2ade53eb3.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/mitt-npm-3.0.1-ce290ffa77-b55a489ac9.zip
vendored
BIN
.yarn/cache/mitt-npm-3.0.1-ce290ffa77-b55a489ac9.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/open-npm-8.4.2-1f763e8b75-6388bfff21.zip
vendored
BIN
.yarn/cache/open-npm-8.4.2-1f763e8b75-6388bfff21.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/pend-npm-1.2.0-7a13d93266-6c72f52433.zip
vendored
BIN
.yarn/cache/pend-npm-1.2.0-7a13d93266-6c72f52433.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/pump-npm-3.0.0-0080bf6a7a-e42e9229fb.zip
vendored
BIN
.yarn/cache/pump-npm-3.0.0-0080bf6a7a-e42e9229fb.zip
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user