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

103
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,103 @@
name: Bug 🐞
description: File a bug/issue with Corteza
title: "When I try to do X I get Y"
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
If this is your first time, please read the following:
Take a quick look on how Github's [markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) works. It will help you format your message and make it joy to read.
Corteza is a complex application with many moving parts. You can help us a lot
by respecting the following instructions for bug reports.
# Web application bugs
When issue requires a certain steps to be followed, record a video, otherwise make a screenshot. If possible resize your window to a minimum size where application is still usable or make a screenshot or recording that focuses on a problem if possible and do not capture your whole screen. This keeps the video files smaller with contents, especially
errors, values readable.
## Favours and versions of your operating system and browsers
Corteza is thoroughly tested on recent versions of Chrome and Firefox. You might have some special combination that we did not cover. If possible, upgrade your system and browser first. It is usually a good thing to do. If you are not able to or the problem persists, please share the version details.
# Server errors
Sometimes the error happens between the request your browser sends and the response it gets. In such cases we would love to see all headers and parameters of that HTTP request and how the response looks like. Text form is perfect.
If you have full control over your server, try enabling full debug logging in your .env fil by setting `LOG_DEBUG=true` and `LOG_LEVEL=debug`, restarting your server and sharing relevant log lines.
As for logs: we usually just need the lines that are related to the request. But if your server does not start or crashes right after, make sure you share everything from first log line on. There might be some values in there you want to obfuscate before sharing.
## Large responses or huge log files
If you want to share something that exceeds 42 lines, try [Github Gist](https://gist.github.com/) and just add a link to Gist you created.
## Favours and versions of your operating system, Docker and Docker Compose
A big share of issues is unrelated to any of these. You can skip this when preparing your bug report. If you did some changes and experimenting with Corteza in such a low level let us know what version you need.
- type: input
attributes:
label: Version of Corteza
placeholder: 202Y.X.x
description: "You can make sure by visiting `/version` (e.g.: http://localhost:3000/version)"
validations:
required: false
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment and versions
description: |
When it is clear that the problem is related to a browser and is not something that happens on the server (between request and response), share your operating system you are using and browser with versions for each one of them.
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking on this area to highlight it and then by dragging files in it.
validations:
required: false

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Community Support
url: https://forum.cortezaproject.org/
about: Please ask and answer questions here.
- name: Ideas, enhancements and feature requests 🚀
url: https://github.com/orgs/cortezaproject/discussions
about: Please open a new discussion and describe the idea you have.

13
.github/PULL_REQUEST_TEMPLATE vendored Normal file
View File

@@ -0,0 +1,13 @@
# The following changes are implemented
TODO: Summary
# Changes in the user interface:
TODO: Add screenshots, recordings or remove this section
# Checklist when submitting a final (!draft) PR
- [ ] Commits are tidied up, squashed if needed and follow guidelines in CONTRIBUTING.md
- [ ] Code builds
- [ ] All existing tests pass
- [ ] All new critical code is covered by tests
- [ ] PR is linked to the relevant issue(s)
- [ ] Rebased with the target branch

1
.github/assets/corteza_logo.svg vendored Normal file
View File

@@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 241.45 38.63"><defs><style>.cls-1{fill:#FF9661;}</style></defs><path class="cls-1" d="M2.51,9.38A18,18,0,0,1,9.37,2.51,19.49,19.49,0,0,1,19.13.05,19.15,19.15,0,0,1,30.21,3.3a17,17,0,0,1,6.64,9h-8.7A9,9,0,0,0,24.5,8.21a10.67,10.67,0,0,0-5.43-1.35A11.24,11.24,0,0,0,13.21,8.4a10.6,10.6,0,0,0-4,4.35,14.41,14.41,0,0,0-1.43,6.59,14.44,14.44,0,0,0,1.43,6.57,10.55,10.55,0,0,0,4,4.38,11.24,11.24,0,0,0,5.86,1.54,10.49,10.49,0,0,0,5.43-1.38,9.16,9.16,0,0,0,3.65-4.08h8.7a16.92,16.92,0,0,1-6.62,9,19.27,19.27,0,0,1-11.1,3.21,19.49,19.49,0,0,1-9.76-2.46,18,18,0,0,1-6.86-6.83A19.69,19.69,0,0,1,0,19.34,19.76,19.76,0,0,1,2.51,9.38Z"/><path class="cls-1" d="M50.43,36.15a18.53,18.53,0,0,1-7-6.89,19.28,19.28,0,0,1-2.59-10A19.13,19.13,0,0,1,43.4,9.38a18.46,18.46,0,0,1,7-6.89,20.29,20.29,0,0,1,19.48,0,18.37,18.37,0,0,1,7,6.89,19.31,19.31,0,0,1,2.56,9.91,19.45,19.45,0,0,1-2.56,10,18.38,18.38,0,0,1-7,6.89,20.31,20.31,0,0,1-19.45,0Zm15.72-5.81a10.53,10.53,0,0,0,4-4.4,14.38,14.38,0,0,0,1.46-6.65,14.2,14.2,0,0,0-1.46-6.62,10.4,10.4,0,0,0-4-4.35,12.72,12.72,0,0,0-12,0,10.34,10.34,0,0,0-4.08,4.35,14.32,14.32,0,0,0-1.46,6.62,14.51,14.51,0,0,0,1.46,6.65,10.47,10.47,0,0,0,4.08,4.4,12.5,12.5,0,0,0,12,0Z"/><path class="cls-1" d="M103.92,38.26,95.6,23.56H92v14.7H84.47V.54H98.62a16.49,16.49,0,0,1,7.46,1.54,10.8,10.8,0,0,1,4.62,4.16,11.32,11.32,0,0,1,1.54,5.86,11.23,11.23,0,0,1-2.16,6.73A11,11,0,0,1,103.65,23l9,15.3ZM92,17.89h6.32A6.33,6.33,0,0,0,103,16.4a5.52,5.52,0,0,0,1.51-4.13,5.29,5.29,0,0,0-1.51-4,6.5,6.5,0,0,0-4.6-1.43H92Z"/><path class="cls-1" d="M142.88.54V6.65h-10V38.26h-7.57V6.65H115.21V.54Z"/><path class="cls-1" d="M155.32,6.65V16.1H168v6h-12.7v10h14.32v6.16H147.75V.49h21.89V6.65Z"/><path class="cls-1" d="M185.42,31.88h17v6.38H176.66V32.42l16.86-25.5H176.66V.54h25.72V6.38Z"/><path class="cls-1" d="M231,31.07H216l-2.49,7.19h-7.94L219.08.49h8.81l13.56,37.77h-8ZM228.91,25,223.46,9.24,218,25Z"/></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

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