-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from tchapgouv/chore/test-node-version
Fix pipeline
- Loading branch information
Showing
19 changed files
with
177 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ karma-reports/ | |
.idea/ | ||
.tmp/ | ||
config.json* | ||
matrix-js-sdk/ | ||
matrix-react-sdk/ | ||
matrix-analytics-events/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
#copied from matrix-react-sdk/scripts | ||
|
||
set -x | ||
|
||
deforg="$1" | ||
defrepo="$2" | ||
defbranch="$3" | ||
|
||
[ -z "$defbranch" ] && defbranch="develop" | ||
|
||
rm -r "$defrepo" || true | ||
|
||
PR_ORG=${PR_ORG:-"matrix-org"} | ||
PR_REPO=${PR_REPO:-"matrix-react-sdk"} | ||
|
||
# A function that clones a branch of a repo based on the org, repo and branch | ||
clone() { | ||
org=$1 | ||
repo=$2 | ||
branch=$3 | ||
if [ -n "$branch" ] | ||
then | ||
echo "Trying to use $org/$repo#$branch" | ||
# Disable auth prompts: https://serverfault.com/a/665959 | ||
GIT_TERMINAL_PROMPT=0 git clone https://github.com/$org/$repo.git $repo --branch "$branch" --depth 1 && exit 0 | ||
fi | ||
} | ||
|
||
# A function that gets info about a PR from the GitHub API based on its number | ||
getPRInfo() { | ||
number=$1 | ||
if [ -n "$number" ]; then | ||
echo "Getting info about a PR with number $number" | ||
|
||
apiEndpoint="https://api.github.com/repos/$PR_ORG/$PR_REPO/pulls/$number" | ||
|
||
head=$(curl $apiEndpoint | jq -r '.head.label') | ||
fi | ||
} | ||
|
||
# Some CIs don't give us enough info, so we just get the PR number and ask the | ||
# GH API for more info - "fork:branch". Some give us this directly. | ||
if [ -n "$BUILDKITE_BRANCH" ]; then | ||
# BuildKite | ||
head=$BUILDKITE_BRANCH | ||
elif [ -n "$PR_NUMBER" ]; then | ||
# GitHub | ||
getPRInfo $PR_NUMBER | ||
elif [ -n "$REVIEW_ID" ]; then | ||
# Netlify | ||
getPRInfo $REVIEW_ID | ||
fi | ||
|
||
# for forks, $head will be in the format "fork:branch", so we split it by ":" | ||
# into an array. On non-forks, this has the effect of splitting into a single | ||
# element array given ":" shouldn't appear in the head - it'll just be the | ||
# branch name. Based on the results, we clone. | ||
BRANCH_ARRAY=(${head//:/ }) | ||
TRY_ORG=$deforg | ||
TRY_BRANCH=${BRANCH_ARRAY[0]} | ||
if [[ "$head" == *":"* ]]; then | ||
# ... but only match that fork if it's a real fork | ||
if [ "${BRANCH_ARRAY[0]}" != "$PR_ORG" ]; then | ||
TRY_ORG=${BRANCH_ARRAY[0]} | ||
fi | ||
TRY_BRANCH=${BRANCH_ARRAY[1]} | ||
fi | ||
clone ${TRY_ORG} $defrepo ${TRY_BRANCH} | ||
|
||
# Try the target branch of the push or PR. | ||
if [ -n "$GITHUB_BASE_REF" ]; then | ||
clone $deforg $defrepo $GITHUB_BASE_REF | ||
elif [ -n "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]; then | ||
clone $deforg $defrepo $BUILDKITE_PULL_REQUEST_BASE_BRANCH | ||
fi | ||
|
||
# Try HEAD which is the branch name in Netlify (not BRANCH which is pull/xxxx/head for PR builds) | ||
clone $deforg $defrepo $HEAD | ||
# Use the default branch as the last resort. | ||
clone $deforg $defrepo $defbranch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
#inspired from ./layered.sh | ||
set -x | ||
|
||
# Creates a layered environment with the full repo for the app and SDKs cloned | ||
# and linked. This gives an tchap-web dev environment ready to build with | ||
# matching branches of react-sdk's dependencies so that changes can be tested | ||
# in tchap-web. | ||
|
||
# Note that this style is different from the recommended developer setup: this | ||
# file nests js-sdk and matrix-react-sdk inside element-web, while the local | ||
# development setup places them all at the same level. We are nesting them here | ||
# because some CI systems do not allow moving to a directory above the checkout | ||
# for the primary repo (element-web in this case). | ||
|
||
# Install dependencies, as we'll be using fetchdep.sh from matrix-react-sdk | ||
yarn install --pure-lockfile | ||
|
||
# Pass appropriate repo to fetchdep.sh (not needed for tchap-web) | ||
#export PR_ORG=vector-im | ||
#export PR_REPO=element-web | ||
|
||
#tchap added : grep matrix dependencies version from package.json | ||
export MATRIX_JS_SDK_VERSION=$(awk -F \" '/"matrix-js-sdk": ".+"/ { print $4; exit; }' package.json) | ||
export MATRIX_REACT_SDK_VERSION=$(awk -F \" '/"matrix-react-sdk": ".+"/ { print $4; exit; }' package.json) | ||
|
||
# Set up the js-sdk first | ||
./scripts/fetchdep.sh matrix-org matrix-js-sdk v$MATRIX_JS_SDK_VERSION | ||
pushd matrix-js-sdk | ||
yarn link | ||
yarn install --pure-lockfile | ||
popd | ||
|
||
# Also set up matrix-analytics-events so we get the latest from | ||
# the main branch or a branch with matching name | ||
./scripts/fetchdep.sh matrix-org matrix-analytics-events main | ||
pushd matrix-analytics-events | ||
yarn link | ||
yarn install --pure-lockfile | ||
yarn build:ts | ||
popd | ||
|
||
# Now set up the react-sdk | ||
./scripts/fetchdep.sh matrix-org matrix-react-sdk v$MATRIX_REACT_SDK_VERSION | ||
pushd matrix-react-sdk | ||
yarn link | ||
yarn link matrix-js-sdk | ||
yarn link @matrix-org/analytics-events | ||
yarn install --pure-lockfile | ||
popd | ||
|
||
# Link the layers into element-web | ||
yarn link matrix-js-sdk | ||
yarn link matrix-react-sdk |