Skip to content

Commit

Permalink
unify package scripts, move ci files to tchap scripts folder (#519)
Browse files Browse the repository at this point in the history
* move ci files to tchap scripts folder
* fix lint
* avoid using install-yarn-linked-repositories when not necessary
* unify tchap package of scalingo and github
* add yarn install
* add yarn linkedin dependencies
  • Loading branch information
odelcroi authored Apr 3, 2023
1 parent cc6498d commit 20194de
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#Build the application
#tchap modification : use "./scripts/tchap/install-yarn-linked-repositories.sh" instead of "./scripts/layered.sh"
name: Build
on:
pull_request: {}
Expand All @@ -23,7 +22,7 @@ jobs:
node-version: 16

- name: Install Dependencies
run: "./scripts/tchap/install-yarn-linked-repositories.sh"
run: "yarn install"

- name: Build
run: "yarn build"
13 changes: 9 additions & 4 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create tag and release for tchap-web
name: Build archives and create release for tchap-web on tag "tchap-"

on:
push:
Expand All @@ -11,6 +11,7 @@ jobs:
permissions:
contents: write
steps:
#Build artifacts for dev, preprod and prod
- uses: actions/checkout@v3
- name: Get Node Version
id: node_version
Expand All @@ -19,24 +20,28 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ steps.node_version.outputs.node_version }}
- name: Install Dependencies
run: "yarn install"
- name: Get Tchap Web Version
id: version
run: echo ::set-output name=version::$(node -e 'console.log(require("./package.json").version)')
- name: Build the archive ${{ steps.version.outputs.version }} for dev
run: scripts/package-github.sh
run: scripts/tchap/package-tchap.sh
env:
CONFIG: dev
- name: Build the archive ${{ steps.version.outputs.version }} for preprod
run: scripts/package-github.sh
run: scripts/tchap/package-tchap.sh
env:
CONFIG: preprod
- name: Build the archive ${{ steps.version.outputs.version }} for prod
run: scripts/package-github.sh
run: scripts/tchap/package-tchap.sh
env:
CONFIG: prod
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

#create release
- name: Create tchap-web release
uses: ncipollo/release-action@v1
with:
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/static_analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#Run a static analysis
#tchap modification : use "./scripts/tchap/install-yarn-linked-repositories.sh" instead of "./scripts/layered.sh"
name: Static Analysis
on:
pull_request: {}
Expand Down Expand Up @@ -68,24 +67,7 @@ jobs:

# Needs branch matching as it inherits .stylelintrc.js from matrix-react-sdk
- name: Install Dependencies
run: "./scripts/tchap/install-yarn-linked-repositories.sh"
run: "yarn install --pure-lockfile"

- name: Run Linter
run: "yarn run lint:style"
# tchap : analyse:unused-exports does not work well with tchap customisations, it raises exception for "default export" not used
#analyse_dead_code:
# name: "Analyse Dead Code"
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

# - uses: actions/setup-node@v3
# with:
# cache: 'yarn'
# node-version: 16

# - name: Install Deps
# run: "scripts/tchap/install-yarn-linked-repositories.sh"

# - name: Dead Code Analysis
# run: "yarn run analyse:unused-exports"
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ src/vector/modernizr.js

#remove tchap files from prettier
patches/patches.json
yarn-linked-dependencies/
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"contribute.json"
],
"style": "bundle.css",
"scripts_comments": {
"build:jitsi": "tchap don't need that, deactivate?"
},
"scripts": {
"i18n": "matrix-gen-i18n",
"prunei18n": "matrix-prune-i18n",
Expand All @@ -43,8 +46,8 @@
"build:module_system": "tsc --project ./tsconfig.module_system.json && node ./lib/module_system/scripts/install.js",
"build:github": "yarn build:genfiles && yarn build:bundle",
"dist": "scripts/package.sh",
"scalingo-postbuild": "scripts/package-scalingo-prod.sh",
"start": "export VERSION=$(scripts/get-version-from-package-json.sh) && yarn build:module_system && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js\"",
"scalingo-postbuild": "scripts/tchap/package-tchap.sh",
"start": "export VERSION=$(scripts/tchap/get-version-from-package-json.sh) && yarn build:module_system && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js\"",
"start:https": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js --https\"",
"start:res": "yarn build:jitsi && node scripts/copy-res.js -w",
"start:js": "webpack-dev-server --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js -w --mode development --disable-host-check --hot",
Expand Down
4 changes: 2 additions & 2 deletions res/themes/tchap-common/css/_tchap_custom.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ div.mx_SettingsTab.mx_SecurityUserSettingsTab > div:nth-child(4) > div:nth-child
}

/* change link color and decoration in login error when email is not autorized */
.mx_Login_error.mx_Login_error_link{
.mx_Login_error.mx_Login_error_link {
color: $alert important!;
text-decoration: underline important!;
}
}
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/tchap/install-yarn-linked-repositories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mkdir -p yarn-linked-dependencies
cd yarn-linked-dependencies

# Set up the js-sdk first
../scripts/fetchdep.with.version.sh matrix-org matrix-js-sdk $MATRIX_JS_SDK_VERSION
../scripts/tchap/fetchdep.with.version.sh matrix-org matrix-js-sdk $MATRIX_JS_SDK_VERSION
pushd matrix-js-sdk
yarn unlink # :TCHAP: for local build, undo previous links if present.
yarn link
Expand All @@ -50,7 +50,7 @@ popd
#popd

# Now set up the react-sdk
../scripts/fetchdep.with.version.sh matrix-org matrix-react-sdk $MATRIX_REACT_SDK_VERSION
../scripts/tchap/fetchdep.with.version.sh matrix-org matrix-react-sdk $MATRIX_REACT_SDK_VERSION
pushd matrix-react-sdk
yarn unlink # :TCHAP: for local build, undo previous links if present.
yarn link
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

#DEPRECRATED, see package-tchap.sh

# Tchap: File copied from scripts/package.json.

set -e

today=$(date +%Y%m%d)

version=$(./scripts/get-version-from-package-json.sh)
version=$(./scripts/tchap/get-version-from-package-json.sh)
export VERSION=$version
echo "VERSION is set to $VERSION"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash

#DEPRECRATED, see package-tchap.sh

# Tchap: File copied from scripts/package.json.
# use package-github instead

set -e

today=$(date +%Y%m%d)

version=$(./scripts/get-version-from-package-json.sh)
version=$(./scripts/tchap/get-version-from-package-json.sh)
export VERSION=$version
echo "VERSION is set to $VERSION"

Expand All @@ -33,8 +36,8 @@ fi

# Copy the files in /dist, ready to be served.
cp -r tchap-$version/* dist/
# Also make a tar file. Useful for releases.
tar chvzf tchap-$version-$CONFIG-$today.tar.gz dist
# Also make a tar file. Useful for releases. EDIT: not needed
#tar chvzf tchap-$version-$CONFIG-$today.tar.gz dist
rm -r tchap-$version

echo
Expand Down
43 changes: 43 additions & 0 deletions scripts/tchap/package-tchap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Tchap: File copied from scripts/package.js
# This file is meant to be used in scalingo and github actions

set -e

today=$(date +%Y%m%d)

version=$(./scripts/tchap/get-version-from-package-json.sh)
export VERSION=$version
echo "VERSION is set to $VERSION"

if [[ -n "$CONFIG" ]]; then
echo "CONFIG=$CONFIG"
cp "config.$CONFIG.json" config.json
echo "Using config.$CONFIG.json"
else
echo "No config specified, using config.json."
fi

yarn clean
yarn build

mkdir -p dist
cp -r webapp tchap-$version

# if $version looks like semver with leading v, strip it before writing to file
if [[ ${version} =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]]; then
echo ${version:1} > tchap-$version/version
else
echo ${version} > tchap-$version/version
fi

# Copy the files in /dist, ready to be served.
cp -r tchap-$version/* dist/

# Also make a tar file. Useful for releases.
#tar chvzf tchap-$version-$CONFIG-$today.tar.gz dist
rm -r tchap-$version

echo
echo "Packaged tchap-$version-$CONFIG"
File renamed without changes.
6 changes: 1 addition & 5 deletions src/util/TchapUrls.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@


export default class TchapUrls {

//url to request the opening of a new domain on Tchap
public static requestDomainUrl = "https://www.demarches-simplifiees.fr/commencer/utiliser-tchap";

}
}

0 comments on commit 20194de

Please sign in to comment.