snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s

This commit is contained in:
upstream-mirror
2026-09-18 01:22:23 +05:00
commit 7e385fc126
8391 changed files with 1766236 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
// Corteza API location
window.CortezaAPI = '//localhost:8888/api'
window.i18nPseudoModeEnabled = false

View File

@@ -0,0 +1,242 @@
const webpack = require('webpack')
const exec = require('child_process').execSync
const path = require('path')
const Vue = require('vue')
module.exports = ({ appFlavour, appLabel, version = process.env.BUILD_VERSION, theme, packageAlias, root = path.resolve('.'), env = process.env.NODE_ENV }) => {
const isDevelopment = (env === 'development')
const isTest = (env === 'test')
if (isTest) {
Vue.config.devtools = false
Vue.config.productionTip = false
}
if (isDevelopment) {
Vue.config.devtools = true
Vue.config.performance = true
}
const optimization = isTest
? {}
: {
usedExports: true,
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
minSize: 20000,
maxSize: 244000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
priority: -10,
},
common: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
}
return {
publicPath: isDevelopment ? '/' : './',
lintOnSave: true,
runtimeCompiler: true,
configureWebpack: {
// other webpack options to merge in ...
// Webpack 5 specific configuration
resolve: {
symlinks: false,
fallback: {
path: false,
fs: false, // Add explicit false for Node.js core modules
crypto: false,
stream: false,
util: false,
},
},
plugins: [
new webpack.DefinePlugin({
FLAVOUR: JSON.stringify(appFlavour),
WEBAPP: JSON.stringify(appLabel),
VERSION: JSON.stringify(version || ('' + exec('git describe --always --tags')).trim()),
BUILD_TIME: JSON.stringify((new Date()).toISOString()),
}),
],
optimization: {
...optimization,
moduleIds: 'deterministic',
chunkIds: 'named',
emitOnErrors: false,
},
stats: {
warnings: false,
errors: false,
},
performance: {
hints: isDevelopment ? false : 'warning',
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
},
chainWebpack: config => {
// https://cli.vuejs.org/guide/troubleshooting.html#symbolic-links-in-node-modules
config.resolve.symlinks(false)
// Remove css extraction issues
// https://github.com/vuejs/vue-cli/issues/3771#issuecomment-526228100
config.plugin('friendly-errors').tap(args => {
const vueCli3Transformer = args[0].additionalTransformers[0]
args[0].additionalTransformers = [
vueCli3Transformer,
error => {
return /\[mini-css-extract-plugin\]/.test(error.message) ? {} : error
},
]
return args
})
// Update copy-webpack-plugin configuration for v8+
config.plugins.has('copy') && config.plugin('copy').tap(options => {
options[0].patterns = [{
from: 'public',
globOptions: {
ignore: ['**/config*js', '**/*gitignore', '**/index.html'],
},
noErrorOnMissing: true,
}]
return options
})
// Aliasing full package name instead of '@' so we do
// not break imports on apps that import this code
config.resolve.alias.delete('@')
if (packageAlias) {
config.resolve.alias.set(packageAlias, root)
}
if (isTest) {
const scssRule = config.module.rule('scss')
scssRule.uses.clear()
scssRule
.use('null-loader')
.loader('null-loader')
}
const scssNormal = config.module.rule('scss').oneOf('normal')
scssNormal.use('sass-loader')
.loader('sass-loader')
.tap(options => ({
...options,
sourceMap: true,
sassOptions: {
outputStyle: isDevelopment ? 'expanded' : 'compressed',
},
}))
// Load CSS assets according to their location
scssNormal.use('resolve-url-loader')
.loader('resolve-url-loader').options({
keepQuery: true,
removeCR: true,
root: path.join(root, 'src/themes', theme),
})
.before('sass-loader')
// Keep this to ensure we don't have multiple HTML plugins
},
devServer: {
host: '127.0.0.1',
port: 8080,
hot: true,
allowedHosts: 'all', // replaces disableHostCheck
webSocketServer: 'ws',
headers: {
'Access-Control-Allow-Origin': '*',
},
proxy: {
'^/custom.css': {
target: fetchBaseUrl(),
},
'^/code-snippets.js': {
target: fetchBaseUrl(),
},
},
// Webpack 5 DevServer configuration
watchFiles: {
paths: [
'**/*',
'!**/node_modules/!(@cortezaproject)/**',
],
options: {
usePolling: true,
aggregateTimeout: 200,
poll: 1000,
},
},
client: {
overlay: false,
progress: true,
},
},
css: {
sourceMap: isDevelopment,
extract: !isTest,
loaderOptions: {
sass: {
sassOptions: {
outputStyle: isDevelopment ? 'expanded' : 'compressed',
},
},
postcss: {
postcssOptions: {
plugins: [
require('autoprefixer'),
require('rtlcss'),
],
},
},
},
},
}
}
function fetchBaseUrl () {
const fs = require('fs')
const window = {}
const fileContents =
fs.existsSync('public/config.js')
? fs.readFileSync('public/config.js', 'utf-8')
: ''
try {
// eslint-disable-next-line no-eval
eval(fileContents)
const u = window.CortezaAPI || ''
const ur = new URL(u.startsWith('//') ? `http:${u}` : u)
return `${ur.protocol}//${ur.host}/`
} catch (e) {
return '/'
}
}

View File

@@ -0,0 +1,62 @@
version: "3.5"
services:
backend:
network_mode: host
image: golang:${GO_VERSION}
volumes:
- "${PWD}:/corteza"
entrypoint: |
sh -c "
git config --global --add safe.directory /corteza &&
go run /corteza/server/cmd/corteza/main.go serve-api
"
working_dir: /corteza/server
environment:
- DB_DSN=postgres://corteza:root@localhost:5432/corteza_cy_test?sslmode=disable
- HTTP_ADDR=:8888
- HTTP_WEBAPP_ENABLED=true
- ENVIRONMENT=dev
- AUTH_REQUEST_RATE_LIMIT=0
- FEDERATION_ENABLED=true
- FEDERATION_HOST=http://corteza
- FEDERATION_LABEL=Corteza e2e federation host
healthcheck:
test: curl --silent --fail-early --fail http://localhost:8888/healthcheck || exit 1
interval: 30s
timeout: 30s
retries: 3
start_period: 60s
postgres:
network_mode: host
image: postgres:15
environment:
POSTGRES_USER: corteza
POSTGRES_PASSWORD: root
POSTGRES_DB: corteza_cy_test
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5
client:
network_mode: host
image: node:22-slim
volumes:
- "${PWD}:/corteza"
working_dir: /corteza
environment:
BUILD_VERSION: 2024.9.10
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1
interval: 30s
timeout: 30s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: 2g

517
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,517 @@
name: "Release"
# These jobs can be tested with nektos/act tool
# https://github.com/nektos/act
#
# Look for "!env.ACT" in the DRY_RUN expression below
on:
push:
tags:
- '**'
env:
BUILD_OS: linux
BUILD_ARCH: amd64
GO_VERSION: 1.24.1
GOFLAGS: -mod=readonly
NODE_VERSION: 22
RELEASE_BASE_URL: "https://releases.cortezaproject.org/files"
SASS_VERSION: 1.85.1
jobs:
server-test:
name: "Server tests"
runs-on: ubuntu-22.04
env:
GOFLAGS: -mod=readonly
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: { go-version: "${{ env.GO_VERSION }}" }
- name: "Copy language files"
working-directory: server/pkg/locale
run: make src/en
- name: "Unit"
working-directory: server
run: make test.unit
- name: "Store"
working-directory: server
run: make test.store
- name: "Integration"
working-directory: server
run: make test.integration
# Building web console for server and cache it for release-* steps
# we'll do this in parallel with tests to gain a few seconds
server-web-console-build:
name: "Server Web Console Build"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-
- name: "Setup YARN"
run: npm install -g yarn @vue/cli-service
- name: "Install dependencies"
working-directory: server/webconsole
run: yarn install
- name: "Build Package"
working-directory: server/webconsole
run: yarn build
- name: "Cache console build"
uses: actions/cache@v3
with: { path: ./server/webconsole/dist, key: console-build }
server-release:
name: "Server Release (${{ matrix.os }})"
strategy:
fail-fast: true
matrix:
include:
- { runsOn: "ubuntu-22.04", os: "linux" }
- { runsOn: "macos-latest", os: "darwin" }
runs-on: ${{ matrix.runsOn }}
needs: [ server-web-console-build, server-test ]
env:
BUILD_OS: ${{ matrix.os }}
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: { go-version: "${{ env.GO_VERSION }}" }
- name: "Restore web console dist from cache"
uses: actions/cache@v3
with: { path: ./server/webconsole/dist, key: console-build }
- name: "Copy essentials"
run: cp *.md DCO LICENSE server/
- name: "Copy language files"
working-directory: server/pkg/locale
run: make src/en src/de src/fr
- name: "Build"
working-directory: server
run: make release-clean release
- name: "Upload"
working-directory: server
run: make upload
if: ${{ !env.ACT }}
########################################################################################################################
########################################################################################################################
# Libs
lib-test:
name: "Library test (${{ matrix.lib }})"
runs-on: ubuntu-22.04
strategy:
matrix:
lib: [ "js", "vue" ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ matrix.lib }}
- name: "Setup YARN"
run: npm install -g yarn @vue/cli-service
- name: "Install dependencies"
working-directory: lib/${{ matrix.lib }}
run: yarn install
- name: "Run all tests"
working-directory: lib/${{ matrix.lib }}
run: yarn test:unit
lib-build-and-publish:
name: "Publish libraries (${{ matrix.lib }})"
runs-on: ubuntu-22.04
needs: [ lib-test ]
strategy:
matrix:
lib: [ "js", "vue" ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org/'
node-version: "${{ env.NODE_VERSION }}"
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ matrix.lib }}
- name: "Setup YARN"
run: npm install -g yarn @vue/cli-service
- name: "Install dependencies"
working-directory: lib/${{ matrix.lib }}
run: yarn install
- name: "Build Package"
working-directory: lib/${{ matrix.lib }}
run: yarn build
- name: "Dry Run Publish"
working-directory: lib/${{ matrix.lib }}
run: npm publish --dry-run
# invalid secret?
# - name: "Publish"
# working-directory: lib/${{ matrix.lib }}
# run: npm publish
# env: { NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" }
# if: ${{ !env.ACT }}
########################################################################################################################
########################################################################################################################
# Web clients
client-web-test:
name: "Web client test (${{ matrix.app }})"
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix: { app: [ admin, compose, discovery, privacy, reporter, one, workflow ] }
needs: [ "lib-build-and-publish" ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- name: "Setup YARN"
working-directory: client/web/${{ matrix.app }}
run: npm install -g yarn @vue/cli-service
- name: "Cache"
uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-
- name: "Dependencies"
working-directory: client/web/${{ matrix.app }}
run: make dep
- name: "Tests"
working-directory: client/web/${{ matrix.app }}
run: make test
client-web-release:
name: "Web client (${{ matrix.app }})"
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix: { app: [ admin, compose, discovery, privacy, reporter, one, workflow ] }
needs: [ client-web-test ]
env:
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- name: "Setup YARN"
run: npm install -g yarn @vue/cli-service
- name: "Cache"
uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-
- name: "Dependencies"
working-directory: client/web/${{ matrix.app }}
run: make dep
- name: "Build"
working-directory: client/web/${{ matrix.app }}
run: make build
- name: "Copy essentials"
run: cp *.md DCO LICENSE client/web/${{ matrix.app }}
- name: "Release"
working-directory: client/web/${{ matrix.app }}
run: make release
- name: "Upload"
working-directory: client/web/${{ matrix.app }}
run: make upload
if: ${{ !env.ACT }}
########################################################################################################################
client-web-aio-release:
name: "Web clients (all-in-one release)"
runs-on: ubuntu-22.04
needs: [ client-web-release ]
env:
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- uses: actions/checkout@v3
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: "Prepare dist dir"
run: |
mkdir -p \
client/web/dist/admin \
client/web/dist/compose \
client/web/dist/workflow \
client/web/dist/reporter \
client/web/dist/discovery \
client/web/dist/privacy
- name: "Download & unpack one"
run: |
curl --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-one-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist
- name: "Download & unpack admin"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-admin-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/admin
- name: "Download & unpack compose"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-compose-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/compose
- name: "Download & unpack workflow"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-workflow-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/workflow
- name: "Download & unpack reporter"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-reporter-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/reporter
- name: "Download & unpack discovery"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-discovery-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/discovery
- name: "Download & unpack privacy"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-privacy-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C client/web/dist/privacy
- name: "Copy essentials"
run: cp *.md DCO LICENSE client/web/dist/
- name: "Pack all web clients"
working-directory: client/web
run: tar -C dist -czf corteza-webapp-${{ env.BUILD_VERSION }}.tar.gz $(dir dist)
- name: "Upload"
working-directory: client/web
run: |
echo ${{ env.RELEASE_SFTP_KEY }} | base64 -d > .upload-rsa && chmod 0400 .upload-rsa
echo "put corteza-webapp-${{ env.BUILD_VERSION }}.tar.gz" | \
sftp -q -o "StrictHostKeyChecking no" -i .upload-rsa ${{ env.RELEASE_SFTP_URI }}
rm -f .upload-rsa
if: ${{ !env.ACT }}
########################################################################################################################
########################################################################################################################
# This is where it all comes together
release:
name: "Corteza (${{ matrix.os }})"
runs-on: ubuntu-22.04
needs: [ server-release, client-web-aio-release ]
strategy:
fail-fast: true
matrix:
os: [ "linux" ]
env:
ENDPOINT: https://releases.cortezaproject.org/files
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: "Download"
run: |
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-server-${{ env.BUILD_VERSION }}-${{ matrix.os }}-amd64.tar.gz" | \
tar -xzmok -C .
mv corteza-server dist
rm -rf dist/webapp
mkdir dist/webapp
curl --silent --location "${{ env.RELEASE_BASE_URL }}/corteza-webapp-${{ env.BUILD_VERSION }}.tar.gz" | \
tar -xzmok -C dist/webapp
- name: "Pack"
run: |
tar -C dist -czf corteza-${{ env.BUILD_VERSION }}-linux-amd64.tar.gz $(dir dist)
- name: "Upload"
run: |
echo ${{ env.RELEASE_SFTP_KEY }} | base64 -d > .upload-rsa
chmod 0400 .upload-rsa
echo "put corteza-${{ env.BUILD_VERSION }}-linux-amd64.tar.gz" | \
sftp -q -o "StrictHostKeyChecking no" -i .upload-rsa ${{ env.RELEASE_SFTP_URI }}
rm -f .upload-rsa
if: ${{ !env.ACT }}
########################################################################################################################
########################################################################################################################
# Discovery
extra-server-discovery-test:
name: "Discovery Server test"
runs-on: ubuntu-22.04
steps:
- name: "Placeholder"
run: echo "@todo add tests"
extra-server-discovery-release:
name: "Discovery Server release ${{ matrix.os }}"
strategy:
fail-fast: true
matrix:
include:
- { runsOn: "ubuntu-22.04", os: "linux" }
- { runsOn: "macos-latest", os: "darwin" }
runs-on: ${{ matrix.runsOn }}
needs: [ extra-server-discovery-test ]
env:
BUILD_OS: ${{ matrix.os }}
BUILD_VERSION: ${{ format(github.ref, 'refs/tags/', '') }}
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: { go-version: "${{ env.GO_VERSION }}" }
- name: "Copy essentials"
run: cp *.md DCO LICENSE extra/server-discovery/
- name: "Build & release"
working-directory: extra/server-discovery/
run: make release-clean release
- name: "Upload"
working-directory: extra/server-discovery/
run: make upload
if: ${{ !env.ACT }}
########################################################################################################################
docker-images:
name: "Docker image ${{ matrix.image }}"
runs-on: ubuntu-22.04
needs:
- server-release
- client-web-aio-release
- extra-server-discovery-release
strategy:
fail-fast: true
matrix:
include:
- { context: "extra/server-discovery", image: "cortezaproject/corteza-server-discovery" }
- { context: "client/web", image: "cortezaproject/corteza-webapp" }
- { context: "server", image: "cortezaproject/corteza-server" }
- { context: ".", image: "cortezaproject/corteza" }
steps:
- uses: actions/checkout@v3
- name: "Parse version tag"
id: version
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "DOCKER_IMAGE_TAG=${TAG}" >> $GITHUB_ENV
if [[ "$(echo ${TAG} | grep '-')" == "" ]]; then
# when releasing patched version (YYYY.MM.PATCH) we
# tag alias (YYYY.MM) as well
echo "DOCKER_IMAGE_ALIAS=$(echo ${TAG} | cut -d '.' -f -2)" >> $GITHUB_ENV
fi
- name: "Build"
run: |
docker build \
--build-arg "VERSION=${{ env.DOCKER_IMAGE_TAG }}" \
--build-arg "SASS_VERSION=${{ env.SASS_VERSION }}" \
--tag ${{ matrix.image }}:${{ env.DOCKER_IMAGE_TAG }} \
${{ matrix.context }}
- name: "Login"
uses: docker/login-action@v2
if: ${{ !env.ACT && env.DOCKER_IMAGE_TAG }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Push ${{ env.DOCKER_IMAGE_TAG }}"
if: ${{ !env.ACT }}
run: |
docker push \
${{ matrix.image }}:${{ env.DOCKER_IMAGE_TAG }}
- name: "Push ${{ env.DOCKER_IMAGE_ALIAS }}"
if: ${{ !env.ACT && env.DOCKER_IMAGE_ALIAS }}
run: |
docker tag \
${{ matrix.image }}:${{ env.DOCKER_IMAGE_TAG }} \
${{ matrix.image }}:${{ env.DOCKER_IMAGE_ALIAS }}
docker push \
${{ matrix.image }}:${{ env.DOCKER_IMAGE_ALIAS }}
notify:
name: "Send matrix release notification"
runs-on: ubuntu-22.04
needs: [ docker-images, release ]
steps:
- uses: actions/checkout@v3
- name: "Parse version tag"
id: version
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "DOCKER_IMAGE_TAG=${TAG}" >> $GITHUB_ENV
- name: "Send message via Matrix on successful release"
if: ${{ !env.ACT }}
id: matrix-chat-release-successful
uses: fadenb/matrix-chat-message@v0.0.6
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
# Corteza **${{ env.DOCKER_IMAGE_TAG }}** has been successfully released 🎉🎉
- name: "Send message via Matrix on failed release"
if: ${{ !env.ACT && failure() }}
id: matrix-chat-release-failed
uses: fadenb/matrix-chat-message@v0.0.6
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
# Corteza **${{ env.DOCKER_IMAGE_TAG }}** release has failed
publish-release-sentry:
name: "Publish release to sentry"
runs-on: ubuntu-22.04
needs: [ notify ]
steps:
- uses: actions/checkout@v3
- name: Create Sentry release
uses: getsentry/action-release@v1
continue-on-error: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
ignore_empty: true
ignore_missing: true
version: ${{ github.ref_name }}

19
.github/workflows/sonar.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: SonarQube
on:
push:
branches:
- '20[0-9][0-9].[0-9].x'
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarqube:
name: SonarQube
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

27
.github/workflows/stale-issues.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
- cron: '0 0 1 * *'
jobs:
stale:
runs-on: ubuntu-22.04
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-close: -1

224
.github/workflows/test-e2e.yml vendored Normal file
View File

@@ -0,0 +1,224 @@
name: 'E2e test on main branch push'
# These jobs can be tested with nektos/act tool
# https://github.com/nektos/act
#
# Look for "!env.ACT" in the DRY_RUN expression below
on:
push:
branches:
- '20[0-9][0-9].[0-9].x'
- '20[0-9][0-9].[0-9].[0-9]'
env:
BUILD_OS: linux
BUILD_ARCH: amd64
GO_VERSION: 1.24.1
GOFLAGS: -mod=readonly
NODE_VERSION: 22
CYPRESS_VERSION: 13.5.0
CYPRESS_HOST: http://localhost:8888
CYPRESS_BASE_URL: http://localhost:8888
CYPRESS_ADMIN_URL: http://localhost:8080
CYPRESS_COMPOSE_URL: http://localhost:8081
CYPRESS_WORKFLOW_URL: http://localhost:8082
CYPRESS_REPORTER_URL: http://localhost:8083
CYPRESS_ONE_URL: http://localhost:8086
CYPRESS_PRIVACY_URL: http://localhost:8087
CYPRESS_USER_EMAIL: cypress@test.com
CYPRESS_USER_PASSWORD: cypress123
CYPRESS_USER_PASSWORD_NEW: newcypress123
CYPRESS_USER_EMAIL_NEW: permissions@email.com
CYPRESS_USER_DPO: dpo@email.com
CYPRESS_USER_DPO_PASSWORD: dpo@email.com
CYPRESS_PROVISION_DB_DSN: postgres://corteza:root@localhost:5432/corteza_cy_test?sslmode=disable
jobs:
server-client-setup:
name: server and client test
strategy:
matrix:
client:
- { port: 8080, name: admin }
# todo - these tests must first be provisioned in order to work,
# only admin for now
# - { port: 8080, name: server }
# - { port: 8081, name: compose }
# - { port: 8082, name: workflow }
# - { port: 8083, name: reporter }
# - { port: 8086, name: one }
# - { port: 8087, name: privacy }
runs-on: ubuntu-22.04
steps:
- name: Setup environment
env:
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }}
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
CLIENT_NAME: ${{ matrix.client.name }}
run: |
echo "TMP_KEY=$(mktemp)" >> $GITHUB_ENV
- name: Create crust key
env:
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
run: |
echo ${RELEASE_CRUST_SFTP_KEY} | base64 -d > ${RELEASE_CRUST_KEY_FILE} && \
echo ${RELEASE_CRUST_SFTP_KEY} > /tmp/foo
- uses: actions/setup-node@v3
with: { node-version: '${{ env.NODE_VERSION }}' }
- uses: actions/setup-go@v3
with: { go-version: '${{ env.GO_VERSION }}' }
- name: Setup YARN
run: npm install -g yarn @vue/cli-service
- name: Checkout corteza repo
uses: actions/checkout@v3
with:
path: corteza
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
- name: Clone CY repo
uses: actions/checkout@v3
with:
repository: cortezaproject/corteza-e2e-cypress
token: ${{ secrets.GITHUB_TOKEN }}
ref: 2024.9.x
path: corteza-e2e-cypress
- name: Cache lib dependencies
uses: actions/cache@v3
with:
path: |
corteza/lib/vue/node_modules
corteza/lib/js/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('corteza/lib/vue/yarn.lock', 'corteza/lib/js/yarn.lock') }}
- name: Copy server language files
working-directory: corteza/server/pkg/locale
run: make src/en
- name: Copy assets
working-directory: corteza
env:
CLIENT_NAME: ${{ matrix.client.name }}
run: |
mv ./.github/workflows/assets/docker-compose.yaml ./
cp .github/workflows/assets/client/vue.config-builder.js client/web/${CLIENT_NAME}/public/vue.config-builder.js
cp .github/workflows/assets/client/config.js client/web/${CLIENT_NAME}/public/config.js
docker compose config > /tmp/docker-compose.corteza.yaml
cd ../corteza-e2e-cypress && docker compose config > /tmp/docker-compose.corteza-e2e.yaml
# - name: Cache Docker images
# uses: ScribeMD/docker-cache@0.3.7
# with:
# key: docker-${{ runner.os }}-${{ hashFiles('/tmp/docker-compose.corteza.yaml', '/tmp/docker-compose.corteza-e2e.yaml') }}
# # Only cache Corteza-specific images, not common base images already on runners
# images: |
# cypress/included:13.5.0
- name: Run server and db
working-directory: corteza
run: |
docker compose run -d --name backend backend
docker compose run -d --name postgres postgres
- name: Build js
working-directory: corteza/lib/js
run: |
yarn install
yarn build
- name: Build vue
working-directory: corteza/lib/vue
run: |
yarn install
yarn build
- name: Run ${{ matrix.client.name }}
working-directory: corteza
# re-link the packages for each app
env:
CLIENT_NAME: ${{ matrix.client.name }}
CLIENT_PORT: ${{ matrix.client.port }}
run: |
docker compose \
run -d \
--name "${CLIENT_NAME}" \
--use-aliases \
client \
sh -c "ls && cd /corteza/lib/js && yarn link && \
cd /corteza/lib/vue && yarn link && \
cd /corteza/client/web/${CLIENT_NAME} && \
yarn link @cortezaproject/corteza-vue && \
yarn link @cortezaproject/corteza-js && \
yarn install && \
yarn serve --port ${CLIENT_PORT}"
# github actions do not support docker-compose --wait
- name: Wait for postgres healthcheck
run: timeout 180s sh -c 'until docker ps | grep postgres | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done'
- name: Wait for ${{ matrix.client.name }} healthcheck
env:
CLIENT_NAME: ${{ matrix.client.name }}
run: |
timeout 180s sh -c 'until docker ps | grep ${CLIENT_NAME} | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done'
- name: Wait for backend healthcheck
run: timeout 180s sh -c 'until docker ps | grep backend | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 1; done'
- name: Run CY tests for ${{ matrix.client.name }}
env:
CLIENT_NAME: ${{ matrix.client.name }}
CLIENT_PORT: ${{ matrix.client.port }}
working-directory: corteza-e2e-cypress
run: |
yarn install
docker compose run \
--entrypoint="bash -c \" \
cypress run --spec cypress/e2e/basic-functionalities/${CLIENT_NAME}/index.cy.js --browser chrome --config video=false,screenshotOnRunFailure=false \
\"" \
cypress
- name: Publish results
# always() runs the step even when canceled manually
if: success() || failure()
working-directory: corteza-e2e-cypress
env:
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }}
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }}
run: |
npx mochawesome-merge "cypress/reports/*.json" > cypress/report.json && \
npx marge -o cypress/reports-build -f index.html -i cypress/report.json && \
echo "put cypress/reports-build/index.html" | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI}
notify-failure:
needs: [server-client-setup]
runs-on: ubuntu-22.04
if: failure()
steps:
- name: Send message on failed testing results
uses: fadenb/matrix-chat-message@v0.0.6
env:
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }}
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }}
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }}
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
❌ E2e tests did not pass
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/

115
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,115 @@
name: "Server and lib tests"
# These jobs can be tested with nektos/act tool
# https://github.com/nektos/act
#
# Look for "!env.ACT" in the DRY_RUN expression below
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- '20[0-9][0-9].[0-9].x'
- '20[0-9][0-9].[0-9].[0-9]'
env:
BUILD_OS: linux
BUILD_ARCH: amd64
GO_VERSION: 1.24.1
GOFLAGS: -mod=readonly
WORKFLOW_STACK_TRACE_FULL: true
NODE_VERSION: 22
jobs:
lib-test:
name: "Library test (${{ matrix.lib }})"
runs-on: ubuntu-22.04
strategy:
matrix:
lib: [ "js", "vue" ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ matrix.lib }}
- name: "Setup YARN"
run: npm install -g yarn @vue/cli-service
- name: "Install dependencies"
working-directory: lib/${{ matrix.lib }}
run: yarn install
- name: "Run all tests"
working-directory: lib/${{ matrix.lib }}
run: yarn test:unit
client-web-test:
name: "Web client test (${{ matrix.app }})"
runs-on: ubuntu-22.04
strategy:
matrix: { app: [ admin, compose, discovery, privacy, reporter, one, workflow ] }
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: "${{ env.NODE_VERSION }}" }
- name: "Setup YARN"
working-directory: client/web/${{ matrix.app }}
run: npm install -g yarn @vue/cli-service
- name: "Cache"
uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-
- name: "Dependencies"
working-directory: client/web/${{ matrix.app }}
run: make dep
- name: "Tests"
working-directory: client/web/${{ matrix.app }}
run: make test
server-test:
name: "Server tests"
runs-on: ubuntu-22.04
env:
GOFLAGS: -mod=readonly
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with: { go-version: "${{ env.GO_VERSION }}" }
- name: "Copy language files"
working-directory: server/pkg/locale
run: make src/en
- name: "Unit"
working-directory: server
run: make test.unit
- name: "Store"
working-directory: server
run: make test.store
- name: "Integration"
working-directory: server
run: make test.integration
notify:
if: failure()
name: "Send matrix testing notification"
runs-on: ubuntu-22.04
needs: [ server-test, client-web-test, lib-test ]
steps:
- name: "Send message via Matrix on failed tests"
if: ${{ !env.ACT && failure() }}
id: matrix-chat-tests-failed
uses: fadenb/matrix-chat-message@v0.0.6
with:
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
channel: ${{ secrets.MATRIX_ROOM_ID }}
message: |
# Corteza **${GITHUB_REF##*/}** tests have failed