Skip to content
Snippets Groups Projects
Commit 54c05d1f authored by Kevin Bonga's avatar Kevin Bonga
Browse files

initial commit

parents
Branches master
No related tags found
No related merge requests found
Showing
with 1028 additions and 0 deletions
aws.xml
workspace.xml
.gitlab-ci-local
Wiki/.idea
NodeApp/src/config/Version.ts
############################ MacOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
############################ Windows
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
############################ Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
nohup.out
############################ Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
############################ Dropbox
# Dropbox settings and caches
.dropbox
.dropbox.attr
.dropbox.cache
########################### Microsoft Office
*.tmp
# Word temporary
~$*.doc*
# Excel temporary
~$*.xls*
# Excel Backup File
*.xlk
# PowerPoint temporary
~$*.ppt*
# Visio autosave temporary files
*.~vsd*
# LibreOffice locks
.~lock.*#
########################### Node
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env*
.flaskenv*
!.env.project
!.env.vault
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
########################### Gitlab Runner
builds/
cache/
########################### JetBrains
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
########################### Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
include: "NodeApp/.gitlab-ci/**.yml"
lint_pass:
only:
variables:
- $FOO == "bar"
script:
- echo
[submodule "NodeApp/.idea/jetbrainsConfiguration"]
path = NodeApp/.idea/jetbrainsConfiguration
url = ../../shared/jetbrains_configuration.git
[submodule "NodeApp/src/shared"]
path = NodeApp/src/shared
url = ../../shared/nodesharedcode.git
[submodule "NodeApp/src/sharedByClients"]
path = NodeApp/src/sharedByClients
url = ../../shared/nodeclientsharedcode.git
# Changelog
<!--
### ✨ Feature
### 🤏 Minor change
### 🎨 Interface
### 🐛 Bugfix
### 🔒 Security
### 🚀‍️ CI / CD
### 🔨 Internal / Developers
### 📚 Documentation
**💥 Breaking:**
**⚠️ Deprecation:**
### 🔨 Internal / Developers
- No modifications / Keep major and minors versions in sync with all parts of the project
-->
## 3.0.0 (?)
### ✨ Feature
- Login to Dojo app via Gitlab OAuth
- User access type management
- **student**: default access type for new users
- **teachingStaff**: student access + possibility of creating assignment
- **admin**: teachingStaff access + access to user access management
## 2.2.0 (2023-10-16)
### ✨ Feature
- `results.json` file is now optional (if the teaching staff don't want to provide test details)
- The exercise will be considered as valid if the container exit code is 0
- The `results.json` file will be construct / completed with the container exit code
- The `volume` argument of `dojo_assignment.json` is now optional (if the teaching staff don't want to provide `results.json` file or other files)
- Assignment run command added (to run the assignment locally)
### 🤏 Minor change
- Immutable files are added to the gitignore file of newly created exercises.
### 🎨 Interface
- The gitlab token can be passed as secret user input in addition to the command line.
### 🔨 Internal / Developers
- Environment support added to CLI config file
### 📚 Documentation
- Wiki update for this new version
## 2.1.0 (2023-09-29)
### ✨ Feature
- Added pipeline badge to exercises
- Creation of Debian / Ubuntu deb packages
### 🎨 Interface
- **💥 Breaking:** Renamed `dojo.enonce` (or `dojo.assignment`) file to `dojo_assignment.json`
### 🔨 Internal / Developers
- Deploy Wiki on Gitlab (on push to `main`) from files of `Wiki` folder
- Migration from .env files stored in Gitlab Secure Files to usage of `dotenv-vault` (locally)
### 📚 Documentation
- Added Wiki base
## 2.0.0 (2023-09-15)
### ✨ Feature
- Added license: AGPLv3
### 🎨 Interface
- **💥 Breaking:** Renamed `enonce` to `assignment`
- **💥 Breaking:** Renamed `exercice` to `exercise`
### 🔨 Internal / Developers
- Auto release by pipeline
- For vX.Y.Z branch create release and tag with `-dev` suffix
- For main branch create definitive release and remove `-dev` releases
## 1.0.1 (2023-08-12)
### ✨ Feature
- 🎉 Initial release of the project
\ No newline at end of file
This diff is collapsed.
#/-------------------.env.vault---------------------/
#/ cloud-agnostic vaulting standard /
#/ [how it works](https://dotenv.org/env-vault) /
#/--------------------------------------------------/
# development
DOTENV_VAULT_DEVELOPMENT="Dp7/4qdTYrrd++/Ny+nykGpmkSKB8DCqhJkuX9/ZQkDB+cvsX5wRTgXBnxA4aIp+HX7QZNnKRKbU3kkzwa3sLHqu58E4Ns1gNGxSYeConwM+ebopPujewxhZbnQ8CxVqMA4cG/GB556yBDtbYYngw2EPdxFlAvLinD5MQbsJvpzDDUiPD9S6bxM20ciMmtsIcV+NI9lInwINIS8vLVWaXVdulnvB4SwVlLiEgfGfiMt2L2YahOG76AnACyL+xKC/QCmAhc3tR6nn6xPdovY3TDWOJe/25Qg2kgm1EvY5ry5r0nskxYPxCe/sIIqhIhE5rvp+uvCCG81Ilec1+RSA7EP7vJ0VJ8zOrurYZn09cZSkrLC+EYuQtlRXk0dBTALfuLWnqpwYN3ADC16YMEc1nI7VtPFwDBnO4cUHikot8XXXNpzsQRKE7S2kt5Cl3YOkO+JYIvNSbqc4OEiWEPZHJp0bNhXPaen0sqACD13GFA5WwaNR+bF9JZKYEZk9AJNp4pHYfuYDbCnTIfxXQ7atO9o90RYZynmX2BtbWCSmj2nWRc2UNfM+P7uZnGWxzrCAY3lb0P0BFrPMBiCzHXqUeOWjHc8s2RU55V/P0JNKEL4ePww9lCAq7dWHQcVtPQCMNU73GgJWtSbmXLw3WRXPtu+Ewe8o+zXuQYd4rUaieyhI36+A50lMEfvbdEpxoqd+guOCzLEo7MDXjNrDnaki2iIs1LHXu0X2p4qycfMHy0xs7lU/2maiUyZwEs3Uyrima1U8SofwPB+akpyfi3qTaIkV73yZWP4tdIEZfCz/lpM+uhyiD5g/YLOU+VoMRy+loUn4PyMIc3dDKLox06fbG8MJPS10goYTwHmsK9K2ywgVJmfQr4JVEY4rsgv22/IKfse1bPF12MCIxUSAKBzQA1rzRSkI8BUtU7cphVX50A3oOJeJe+t5/SdKTF4HwIE895rb2u4YceJt5UYKjxxTibmx1q9qzrLeeUbGemO9vvCrkxzSt7OUvMKR52GEwakE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AniXxNFBz/Zurisl74Bjl8CRCVaqq7ATPXeR+IsVd6B8Cs1QPWWuxU5Z1PCiot6kWTp69p45nHQMmUEdl5eUSATaG4PgwLlZ1vysB/O4J6npmYHF4IFAE8yLNbiWg7IuhlEFTYk9UgvUC+gLaymDTTtr/DqwjU3F/oFYkjR3/Go7L2s03VU3pU5PShua+AWg8Wfli1NQ9n3/rbwXAnsrS2J0qV6n3oFm9yv/0g/+RiOIko39UgJ1syZzbTpDRMtqJOg=="
.env*
.flaskenv*
!.env.project
!.env.vault
\ No newline at end of file
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: "true"
SECURE_FILES_DOWNLOAD_PATH: './'
PROJECT_NAME: DojoCLI
PROJECT_FOLDER: NodeApp
RESOURCES_FOLDER: "${CI_PROJECT_DIR}/Resources"
BIN_NAME: dojo
PKG_EXTENSION_DEBIAN: '.deb'
PKG_EXTENSION_MACOS: '.pkg'
PKG_BIN_NAME_DEBIAN: "${BIN_NAME}${PKG_EXTENSION_DEBIAN}"
PKG_BIN_NAME_MACOS: "${BIN_NAME}${PKG_EXTENSION_MACOS}"
BIN_EXTENSION_WINDOWS: '.exe'
BIN_NAME_WINDOWS: "${BIN_NAME}${BIN_EXTENSION_WINDOWS}"
ARTIFACTS_FOLDER: /artifacts
GITLAB_API_PROJECT_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}
BIN_FOLDER_MACOS: $ARTIFACTS_FOLDER/macOS
BIN_FOLDER_LINUX: $ARTIFACTS_FOLDER/Linux
BIN_FOLDER_WINDOWS: $ARTIFACTS_FOLDER/Windows
BIN_FOLDER_LINUX_ARM64: $BIN_FOLDER_LINUX/arm64
BIN_FOLDER_LINUX_X64: $BIN_FOLDER_LINUX/x64
BIN_FOLDER_MACOS_ARM64: $BIN_FOLDER_MACOS/arm64
BIN_FOLDER_MACOS_X64: $BIN_FOLDER_MACOS/x64
BIN_FOLDER_WINDOWS_ARM64: $BIN_FOLDER_WINDOWS/arm64
BIN_FOLDER_WINDOWS_X64: $BIN_FOLDER_WINDOWS/x64
BIN_FILE_MACOS_ARM64: $BIN_FOLDER_MACOS_ARM64/$BIN_NAME
BIN_FILE_MACOS_X64: $BIN_FOLDER_MACOS_X64/$BIN_NAME
BIN_FILE_LINUX_ARM64: $BIN_FOLDER_LINUX_ARM64/$BIN_NAME
BIN_FILE_LINUX_X64: $BIN_FOLDER_LINUX_X64/$BIN_NAME
BIN_FILE_WINDOWS_ARM64: $BIN_FOLDER_WINDOWS_ARM64/$BIN_NAME_WINDOWS
BIN_FILE_WINDOWS_X64: $BIN_FOLDER_WINDOWS_X64/$BIN_NAME_WINDOWS
BIN_PKG_FILE_DEBIAN_ARM64: $BIN_FOLDER_LINUX_ARM64/$PKG_BIN_NAME_DEBIAN
BIN_PKG_FILE_DEBIAN_X64: $BIN_FOLDER_LINUX_X64/$PKG_BIN_NAME_DEBIAN
BIN_PKG_FILE_MACOS_ARM64: $BIN_FOLDER_MACOS_ARM64/$PKG_BIN_NAME_MACOS
BIN_PKG_FILE_MACOS_X64: $BIN_FOLDER_MACOS_X64/$PKG_BIN_NAME_MACOS
VERSION_FILE: $ARTIFACTS_FOLDER/VERSION
VERSION_DEV_SUFFIX: '-dev'
PACKAGE_REGISTRY_URL: "${GITLAB_API_PROJECT_URL}/packages/generic/${BIN_NAME}"
WIKI_FOLDER: Wiki
\ No newline at end of file
.get_version:
script:
- IS_DEV=$([[ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]] && echo false || echo true)
- VERSION=$(jq -r .version $PROJECT_FOLDER/package.json)$([[ $IS_DEV == true ]] && echo $VERSION_DEV_SUFFIX || echo '')
.get_last_stable_version:
script:
# Get all releases of the project
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" "${GITLAB_API_PROJECT_URL}/releases" > releases.json'
# Filter and select last package that don't contains "-dev" in its name
- LAST_STABLE_VERSION=`jq -r '[.[] | .name | select (contains("$VERSION_DEV_SUFFIX") | not)][0]' releases.json`
.get_packages_url:
script:
# Binaries
- PACKAGE_URL_MACOS_ARM64_BIN="${PACKAGE_REGISTRY_URL}_macOS-arm64/${VERSION}/${BIN_NAME}"
- PACKAGE_URL_MACOS_X64_BIN="${PACKAGE_REGISTRY_URL}_macOS-x64/${VERSION}/${BIN_NAME}"
- PACKAGE_URL_LINUX_ARM64_BIN="${PACKAGE_REGISTRY_URL}_Linux-arm64/${VERSION}/${BIN_NAME}"
- PACKAGE_URL_LINUX_X64_BIN="${PACKAGE_REGISTRY_URL}_Linux-x64/${VERSION}/${BIN_NAME}"
- PACKAGE_URL_WINDOWS_ARM64_BIN="${PACKAGE_REGISTRY_URL}_Windows-arm64/${VERSION}/${BIN_NAME_WINDOWS}"
- PACKAGE_URL_WINDOWS_X64_BIN="${PACKAGE_REGISTRY_URL}_Windows-x64/${VERSION}/${BIN_NAME_WINDOWS}"
# Packages
- PACKAGE_URL_MACOS_ARM64_PKG="${PACKAGE_REGISTRY_URL}_macOS-pkg-arm64/${VERSION}/${PKG_BIN_NAME_MACOS}"
- PACKAGE_URL_MACOS_X64_PKG="${PACKAGE_REGISTRY_URL}_macOS-pkg-x64/${VERSION}/${PKG_BIN_NAME_MACOS}"
- PACKAGE_URL_DEBIAN_ARM64_PKG="${PACKAGE_REGISTRY_URL}_debian-pkg-arm64/${VERSION}/${PKG_BIN_NAME_DEBIAN}"
- PACKAGE_URL_DEBIAN_X64_PKG="${PACKAGE_REGISTRY_URL}_debian-pkg-x64/${VERSION}/${PKG_BIN_NAME_DEBIAN}"
# Wiki
- WIKI_ARCHIVE_NAME="${PROJECT_NAME}_Wiki_${VERSION}.tar.xz"
- PACKAGE_URL_WIKI="${PACKAGE_REGISTRY_URL}_Wiki/${VERSION}/${WIKI_ARCHIVE_NAME}"
.build_cli:
script:
- cd "${PROJECT_FOLDER}"
# Install dependencies
- npm install
# Set version number shown in CLI
- sed -i -r "s/\{\{VERSION\}\}/${VERSION}/g" src/commander/CommanderApp.ts
# Decrypt env vars for production
- |
if [ $CI_COMMIT_REF_PROTECTED == "true" ]; then
echo "Decrypt production env vars"
sed -i -r "s/(DOTENV_KEY[ ]*:[ ]*[\'\"\`])[^'\"\`]*([\'\"\`])([ ]*\,)?//g" src/app.ts
sed -i -r "s/,[\ \n]*\}/\}/g" src/app.ts
npx dotenv-vault local decrypt "${DOTENV_PROD_KEY}" > .env
fi
# Build
- npm run build
# Build binaries
## macOS
- npx pkg . -t node18-macos-arm64 --output $BIN_FILE_MACOS_ARM64 --no-bytecode --compress Brotli --public-packages "*" --public
- npx pkg . -t node18-macos-x64 --output $BIN_FILE_MACOS_X64 --no-bytecode --compress Brotli --public-packages "*" --public
## Linux
- npx pkg . -t node18-linuxstatic-arm64 --output $BIN_FILE_LINUX_ARM64 --no-bytecode --compress Brotli --public-packages "*" --public
- npx pkg . -t node18-linuxstatic-x64 --output $BIN_FILE_LINUX_X64 --no-bytecode --compress Brotli --public-packages "*" --public
## Windows
- npx pkg . -t node18-win-arm64 --output $BIN_FILE_WINDOWS_ARM64 --no-bytecode --compress Brotli --public-packages "*" --public
- npx pkg . -t node18-win-x64 --output $BIN_FILE_WINDOWS_X64 --no-bytecode --compress Brotli --public-packages "*" --public
# Add execution rights to binaries
## macOS
- chmod +x $BIN_FILE_MACOS_ARM64
- chmod +x $BIN_FILE_MACOS_X64
## Linux
- chmod +x $BIN_FILE_LINUX_ARM64
- chmod +x $BIN_FILE_LINUX_X64
## Windows
- chmod +x $BIN_FILE_WINDOWS_ARM64
- chmod +x $BIN_FILE_WINDOWS_X64
.clean_release:
script:
# Delete release if it already exists
- 'curl --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" "${GITLAB_API_PROJECT_URL}/releases/${VERSION}"'
# Delete tag if it already exists (use private-token because job-token don't have permission to delete tags)
- 'curl --request DELETE --header "PRIVATE-TOKEN: $GITLAB_PROJECT_ACCESS_TOKEN" "${GITLAB_API_PROJECT_URL}/repository/tags/${VERSION}"'
.clean_packages:
script:
# Get all packages of the project
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" "${GITLAB_API_PROJECT_URL}/packages" > gitlabPackages.json'
# Filter and select packages to delete (based on version)
- packagesToDelete=`jq -r '.[] | select(.version=="'${VERSION}'") | ._links.delete_api_path' gitlabPackages.json`
# Delete packages by calling Gitlab API
- >
for deletePath in $packagesToDelete; do
echo "Deleting package at path : ${deletePath}"
curl --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" "${deletePath}"
done
\ No newline at end of file
.pkg_and_sign:debian:
stage: pkg_and_sign
image: ubuntu:latest
tags:
- pkg
dependencies:
- build:version
script:
# Install dependencies
- apt update
- apt install -y dpkg jq curl build-essential
# Get vars
- !reference [ .get_version, script ]
- !reference [ .get_last_stable_version, script ]
- cd $BIN_FOLDER_DEBIAN_PKG_AND_SIGN
- PKG_BUILD_FOLDER_NAME="${BIN_NAME}_${VERSION}_${ARCH}"
# Pkg tree creation
- mkdir -p "${PKG_BUILD_FOLDER_NAME}/usr/local/bin/"
## Copy binary
- cp -R ${BIN_NAME} "${PKG_BUILD_FOLDER_NAME}/usr/local/bin/"
## Copy debian folder with package definition files
- cp -R "${RESOURCES_FOLDER}/Debian/pkg/DEBIAN" "${PKG_BUILD_FOLDER_NAME}"
# Modify files
- cd "${PKG_BUILD_FOLDER_NAME}/DEBIAN"
## control file
- sed -i -r "s%\{\{VERSION\}\}%${VERSION}%g" control
- sed -i -r "s%\{\{ARCH\}\}%${ARCH}%g" control
- sed -i -r "s%\{\{BIN_NAME\}\}%${BIN_NAME}%g" control
## changelog file
- STABILITY=$([[ $IS_DEV == true ]] && echo 'unstable' || echo 'stable')
- PRIORITY=$([[ ${VERSION%.*} == ${LAST_STABLE_VERSION%.*} ]] && echo 'medium' || echo 'high')
- sed -i -r "s%\{\{VERSION\}\}%${VERSION}%g" changelog
- sed -i -r "s%\{\{BIN_NAME\}\}%${BIN_NAME}%g" changelog
- sed -i -r "s%\{\{DATE\}\}%$(date -R)%g" changelog
- sed -i -r "s%\{\{URL\}\}%${CI_PROJECT_URL}%g" changelog
- sed -i -r "s%\{\{STABILITY\}\}%${STABILITY}%g" changelog
- sed -i -r "s%\{\{PRIORITY\}\}%${PRIORITY}%g" changelog
## copyright file
- sed -i -r "s%\{\{BIN_NAME\}\}%${BIN_NAME}%g" copyright
## return to bin folder
- cd $BIN_FOLDER_DEBIAN_PKG_AND_SIGN
# Build package
- dpkg-deb --build --root-owner-group -Z xz -z 9 ${PKG_BUILD_FOLDER_NAME} ${PKG_BIN_NAME_DEBIAN}
# Clean folder
- rm -Rf ${PKG_BUILD_FOLDER_NAME}
artifacts:
paths:
- $ARTIFACTS_FOLDER/*
expire_in: 10 mins
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
.pkg_and_sign:macos:
stage: pkg_and_sign
tags:
- macos_signing
dependencies:
- build:version
script:
- VERSION=$(cat $VERSION_FILE)
- security unlock-keychain -p $SIGN_KEYCHAIN_PASSWORD $SIGN_LOGIN_KEYCHAIN_PATH
- cd $BIN_FOLDER_MACOS_PKG_AND_SIGN
# Sign excecutable
- codesign --force --options=runtime --entitlements ../../../Resources/macOS/Signing/entitlements.plist --sign $SIGN_DEV_ID_APP --keychain $SIGN_LOGIN_KEYCHAIN_PATH --timestamp ${BIN_NAME}
# Package and notarize the app
- xcrun notarytool store-credentials --apple-id $SIGN_APPLE_ID --team-id $SIGN_TEAM_ID --password $SIGN_APP_PASSWORD --keychain $SIGN_LOGIN_KEYCHAIN_PATH $SIGN_KEYCHAIN_PROFILE
- ditto ${BIN_NAME} ${BIN_NAME}_pkg/usr/local/bin/
- productbuild --identifier $SIGN_IDENTIFIER --version $VERSION --sign $SIGN_DEV_ID_INST --keychain $SIGN_LOGIN_KEYCHAIN_PATH --timestamp --root ${BIN_NAME}_pkg / ${PKG_BIN_NAME_MACOS}
- xcrun notarytool submit ${BIN_NAME}.pkg --keychain $SIGN_LOGIN_KEYCHAIN_PATH --keychain-profile $SIGN_KEYCHAIN_PROFILE --wait
- xcrun stapler staple ${BIN_NAME}.pkg
# Clean folder
- rm -Rf ${BIN_NAME}_pkg
artifacts:
paths:
- $ARTIFACTS_FOLDER/*
expire_in: 10 mins
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
\ No newline at end of file
stages:
- test
- build
- pkg_and_sign
- clean
- upload
- release
\ No newline at end of file
test:build:
stage: test
tags:
- build
image: node:latest
script:
- apt update
- apt install -y jq
- !reference [ .get_version, script ]
# Build
- !reference [ .build_cli, script ]
rules:
- if: '$CI_COMMIT_REF_PROTECTED != "true"'
build:version:
stage: build
tags:
- build
image: node:latest
script:
- apt update
- apt install -y jq
- !reference [ .get_version, script ]
- mkdir -p $ARTIFACTS_FOLDER
- echo $VERSION > $VERSION_FILE
# Build
- !reference [ .build_cli, script ]
artifacts:
untracked: true
paths:
- $ARTIFACTS_FOLDER/*
expire_in: 10 mins
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
pkg_and_sign:debian:
parallel:
matrix:
- ARCH: [ "arm64", "amd64" ]
before_script:
- BIN_FOLDER_DEBIAN_PKG_AND_SIGN=$([[ $ARCH == "arm64" ]] && echo ${BIN_FOLDER_LINUX_ARM64} || echo ${BIN_FOLDER_LINUX_X64})
extends: .pkg_and_sign:debian
pkg_and_sign:macos:
parallel:
matrix:
- BIN_FOLDER_MACOS_PKG_AND_SIGN: [ "$BIN_FOLDER_MACOS_ARM64", "$BIN_FOLDER_MACOS_X64" ]
extends: .pkg_and_sign:macos
\ No newline at end of file
clean:release:
stage: clean
tags:
- gitlab_clean
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- !reference [ .clean_release, script ]
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
clean:packages:
stage: clean
tags:
- gitlab_clean
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- !reference [ .clean_packages, script ]
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
clean:dev:release:
stage: clean
tags:
- gitlab_clean
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- VERSION="${VERSION}${VERSION_DEV_SUFFIX}"
- !reference [ .clean_release, script ]
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
clean:dev:packages:
stage: clean
tags:
- gitlab_clean
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- VERSION="${VERSION}${VERSION_DEV_SUFFIX}"
- !reference [ .clean_packages, script ]
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
\ No newline at end of file
upload:packages:
stage: upload
tags:
- gitlab_package
dependencies:
- pkg_and_sign:macos
- pkg_and_sign:debian
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- !reference [ .get_packages_url, script ]
# macOS
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_MACOS_ARM64} "${PACKAGE_URL_MACOS_ARM64_BIN}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_MACOS_X64} "${PACKAGE_URL_MACOS_X64_BIN}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_PKG_FILE_MACOS_ARM64} "${PACKAGE_URL_MACOS_ARM64_PKG}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_PKG_FILE_MACOS_X64} "${PACKAGE_URL_MACOS_X64_PKG}";'
# Linux
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_LINUX_ARM64} "${PACKAGE_URL_LINUX_ARM64_BIN}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_LINUX_X64} "${PACKAGE_URL_LINUX_X64_BIN}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_PKG_FILE_DEBIAN_ARM64} "${PACKAGE_URL_DEBIAN_ARM64_PKG}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_PKG_FILE_DEBIAN_X64} "${PACKAGE_URL_DEBIAN_X64_PKG}";'
# Windows
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_WINDOWS_ARM64} "${PACKAGE_URL_WINDOWS_ARM64_BIN}";'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${BIN_FILE_WINDOWS_X64} "${PACKAGE_URL_WINDOWS_X64_BIN}";'
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
upload:packages:wiki:
stage: upload
tags:
- gitlab_package
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
# Install dependencies
- apk update
- apk add xz
- !reference [ .get_version, script ]
- !reference [ .get_packages_url, script ]
# Create archive
- WIKI_ARCHIVE_PATH="${ARTIFACTS_FOLDER}/${WIKI_ARCHIVE_NAME}"
- tar -v -c -C "${CI_PROJECT_DIR}/${WIKI_FOLDER}" -J -f "${WIKI_ARCHIVE_PATH}" . # Ubuntu: tar --verbose --create --cd wiki-test-2 --xz --file file.tar.bz2
# Send package
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${WIKI_ARCHIVE_PATH} "${PACKAGE_URL_WIKI}";'
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
\ No newline at end of file
release:wiki:
stage: release
tags:
- release
image: alpine:latest
script:
- apk update
- apk add git
- apk add jq
- !reference [ .get_version, script ]
# Define URL for the wiki in terms of project-agnostic predefined variables
- WIKI_URL="${CI_SERVER_PROTOCOL}://project_${CI_PROJECT_ID}_bot:${GITLAB_PROJECT_ACCESS_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_PATH}.wiki.git"
# Clone this project's wiki under /tmp
- rm -rf "/tmp/${CI_PROJECT_NAME}.wiki"
- cd /tmp
- git clone "${WIKI_URL}"
# Enter the cloned repo
- cd "${CI_PROJECT_NAME}.wiki"
# Update the file
- mv .git/ ../
- rm -rf ./*
- mv ../.git/ ./
- cp "${CI_PROJECT_DIR}/.gitignore" .
- cp -R "${CI_PROJECT_DIR}/${WIKI_FOLDER}/." .
# Set committer info
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
# Commit the gitignore file
- git add ".gitignore"
- git commit -m "Add gitignore file" || true
# Commit the file
- git add .
- git commit -m "${VERSION}" || true
# Push the change back to the master branch of the wiki
- git push origin "HEAD:main"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
release:gitlab:
stage: release
tags:
- release
image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script:
- !reference [ .get_version, script ]
- !reference [ .get_packages_url, script ]
# Extract description from CHANGELOG.md
- CHANGELOG_LINE_START=`awk '/##\ [0-9]+\.[0-9]+\.[0-9]+/{print NR; exit;}' CHANGELOG.md`
- CHANGELOG_LINE_END=`awk '/##\ [0-9]+\.[0-9]+\.[0-9]+/{ count++; if(count>1) {print NR; exit;}}' CHANGELOG.md`
- DESCRIPTION=`awk 'NR > '$CHANGELOG_LINE_START' && NR < '$CHANGELOG_LINE_END'' CHANGELOG.md`
# Create Release (can't be done by release_step of gitlab image because it don't have access to env var defined in script_step)
- >
RELEASE_DATA=$(jq --null-input --arg version "$VERSION" --arg description "# Changelog (version $VERSION) $DESCRIPTION" --arg tag_name "$VERSION" --arg ref "$CI_COMMIT_SHORT_SHA" '{
"name": $version,
"description": $description,
"tag_name": $tag_name,
"ref": $ref,
"assets": {
"links": [
{
"name": "Windows (ARM64) binary",
"url": "'${PACKAGE_URL_WINDOWS_ARM64_BIN}'",
},{
"name": "Windows (x64) binary",
"url": "'${PACKAGE_URL_WINDOWS_X64_BIN}'",
},{
"name": "Linux (ARM64) binary",
"url": "'${PACKAGE_URL_LINUX_ARM64_BIN}'",
},{
"name": "Linux (x64) binary",
"url": "'${PACKAGE_URL_LINUX_X64_BIN}'",
},{
"name": "Debian / Ubuntu (ARM64) package",
"url": "'${PACKAGE_URL_DEBIAN_ARM64_PKG}'",
},{
"name": "Debian / Ubuntu (x64) package",
"url": "'${PACKAGE_URL_DEBIAN_X64_PKG}'",
},{
"name": "macOS (Intel) binary",
"url": "'${PACKAGE_URL_MACOS_X64_BIN}'",
},{
"name": "macOS (Apple Silicon) binary",
"url": "'${PACKAGE_URL_MACOS_ARM64_BIN}'",
},{
"name": "macOS (Intel) package",
"url": "'${PACKAGE_URL_MACOS_X64_PKG}'",
},{
"name": "macOS (Apple Silicon) package",
"url": "'${PACKAGE_URL_MACOS_ARM64_PKG}'",
},{
"name": "Wiki",
"url": "'${PACKAGE_URL_WIKI}'",
}
]
}
}')
- >
curl --data "${RELEASE_DATA}" \
--header "Content-Type: application/json" \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--request POST "${GITLAB_API_PROJECT_URL}/releases"
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
DojoCLI
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<content url="file://$MODULE_DIR$/.gitlab-ci-local">
<excludeFolder url="file://$MODULE_DIR$/.gitlab-ci-local" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment