Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the mattermost-webapp from the monorepo of mattermost #1074

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem like unrelated changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was facing a very peculiar error https://github.com/mattermost/mattermost-plugin-jira/actions/runs/8938919453/job/24553976441, so there was a package named file-hound of frontend, and after it was installed, it was creating an empty go file, and in the lint as well as test CI, we run commands like go test ./... which basically going to work on all files including the node modules and that's why we were getting the above error. So for now I have made the go commands to only work in the server folder and not outside of it.
@hanzei

Copy link
Contributor

@mickmister mickmister May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem @hanzei may have with this is that the build folder is no longer being checked. Can we instead make it so only webapp exists in the monorepo checkout folder? Either we can do something replacing the whole repo with just the webapp directory like:

mv mattermost-webapp/webapp .
rm -rf mattermost-webapp
mv webapp mattermost-webapp

Naming the cloned directory just mattermost may make more sense here. Then this becomes:

mv mattermost/webapp .
rm -rf mattermost
mv webapp mattermost-webapp

Alternatively we can do a sparse checkout, but that seems more complicated https://stackoverflow.com/a/52270636

Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ endif
# weird reports at golangci-lint step
ifneq ($(HAS_SERVER),)
@echo Running golangci-lint
$(GO) vet ./...
$(GOBIN)/golangci-lint run ./...
$(GO) vet ./server/... ./build/...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this? Or will $(GO) vet ./... work since we changed how the monorepo checkout works?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I ask, is we want to keep the Makefile as identical to the starter template's Makefile as we can. This change creates drift between the two repos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mickmister Yeah we still require the file-hound package and its respective files.

$(GOBIN)/golangci-lint run ./server/... ./build/...
endif

## Builds the server, if it exists, for all supported architectures, unless MM_SERVICESETTINGS_ENABLEDEVELOPER is set
Expand Down Expand Up @@ -309,7 +309,7 @@ detach: setup-attach
.PHONY: test
test: apply webapp/node_modules install-go-tools
ifneq ($(HAS_SERVER),)
$(GOBIN)/gotestsum -- -v ./...
$(GOBIN)/gotestsum -- -v ./server/... ./build/...
endif
ifneq ($(HAS_WEBAPP),)
cd webapp && $(NPM) run test;
Expand All @@ -320,7 +320,7 @@ endif
.PHONY: test-ci
test-ci: apply webapp/node_modules install-go-tools
ifneq ($(HAS_SERVER),)
$(GOBIN)/gotestsum --format standard-verbose --junitfile report.xml -- ./...
$(GOBIN)/gotestsum --format standard-verbose --junitfile report.xml -- ./server/...
endif
ifneq ($(HAS_WEBAPP),)
cd webapp && $(NPM) run test;
Expand All @@ -330,7 +330,7 @@ endif
.PHONY: coverage
coverage: apply webapp/node_modules
ifneq ($(HAS_SERVER),)
$(GO) test $(GO_TEST_FLAGS) -coverprofile=server/coverage.txt ./server/...
$(GO) test $(GO_TEST_FLAGS) -coverprofile=server/coverage.txt ./server/... ./build/...
$(GO) tool cover -html=server/coverage.txt
endif

Expand Down
1 change: 1 addition & 0 deletions webapp/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mattermost-webapp/*
1 change: 1 addition & 0 deletions webapp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
node_modules
.npminstall
mattermost-webapp
27 changes: 27 additions & 0 deletions webapp/install_mattermost_webapp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
readonly COMMITHASH=`jq -r '.localPackages.mattermost_webapp' package.json`

echo "\n\nInstalling mattermost-webapp from the mattermost repo, using commit hash $COMMITHASH\n"

if [ ! -d mattermost-webapp ]; then
mkdir mattermost-webapp
fi

cd mattermost-webapp

if [ ! -d .git ]; then
git init
git config --local uploadpack.allowReachableSHA1InWant true
git remote add origin https://github.com/mattermost/mattermost.git
fi

git fetch --depth=1 origin $COMMITHASH
git reset --hard FETCH_HEAD

cd ..
mv mattermost-webapp/webapp .
rm -rf mattermost-webapp
mv webapp mattermost-webapp

npm i --save-dev ./mattermost-webapp/channels
npm i --save-dev ./mattermost-webapp/platform/types
npm i --save-dev ./mattermost-webapp/platform/client
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
187 changes: 0 additions & 187 deletions webapp/junit.xml

This file was deleted.

Loading
Loading