1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

12 Commits

Author SHA1 Message Date
Christopher Kolstad
3409b0c5a0
task: Add Unit test result check task (#3695)
After a Team Retro, one of our squads felt like we needed more data on
our test suites. This is the first effort to make our test results
easier to grab. It uses the test-reporter action to add a github check
to our main build and PR builds with our test results.

This at least should make it easier to parse which tests are failing.
However, it does not give us trends. So it does not yet make it easier
to decide which tests are flaky just from a quick view.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-05-25 11:03:54 +00:00
Nuno Góis
a9c24e4262
chore: simplify package scripts (#3736)
# Simplify package scripts

This PR's purpose is to raise a discussion surrounding our current
package scripts.

It includes some suggestions that aim to simplify the scripts and
hopefully bring a much more straightforward approach to developing and
contributing to Unleash.

Building (prod) should only happen **explicitly** and when needed.

## Before PR (current behavior)

- Clone the project;
- Open 2 terminals: One for `unleash` and another for
`unleash/frontend`;
- On `unleash`: 
  - Run `yarn` (which will also build, for some reason?);
  - Run `yarn start:dev` to start backend in dev mode (`tsc-watch`);
- On `unleash/frontend`:
  - Run `yarn` (which will also build, for some reason?);
  - Run `yarn start` to start frontend in dev mode (`vite`);

So it seems to me like we build unnecessarily every time we install
dependencies. Neither dev scripts need to build the project, as backend
uses `tsc-watch` and frontend uses `vite`. I'm unsure why this is the
case, as building can take a very long time.


![image](https://github.com/Unleash/unleash/assets/14320932/5ecb7df1-e5b4-4d70-ba7e-97119f5d1116)

There's also some complexity in the way we need to split the terminal to
`cd` into `frontend` and treat it as a different project. The fact that
we have different script names is also confusing (`yarn start`, `yarn
start:dev`, etc).

## After PR

- Clone the project;
- Run `yarn` to install all dependencies;
- Run `yarn dev` to get started developing Unleash;

Running `yarn` should take care of everything needed to start
developing. This includes installing dependencies for frontend as well.
It should not build projects if we are not being explicit about it,
especially since we don't need to build them at this stage.


![image](https://github.com/Unleash/unleash/assets/14320932/614e42fc-3467-432f-91fc-624b1b35c7c1)

Running `yarn dev` should start the project in dev mode. This means
running both projects in `dev` mode, which for `backend` means running
`tsc-watch` and for `frontend` means running `vite`.

Here this PR attempts to provide a better DX by using
[concurrently](https://www.npmjs.com/package/concurrently) and
[wait-on](https://www.npmjs.com/package/wait-on) - This means both tasks
are ran simultaneously, stdout is labeled accordingly, and are stopped
together. It also means that `frontend` waits for `backend` to be
serving at `4242` before starting, since `frontend` starts pretty much
immediately with `vite` and `backend` takes a bit longer. Of course,
when the `backend` is hot-reloading you may still find some
`ECONNREFUSED`s on `frontend` stdout while it recompiles.


![image](https://github.com/Unleash/unleash/assets/14320932/8bde8ee2-3cad-4e3f-a0db-9eed60cfb04d)

No more splitting your terminal and treating `frontend` as a separate
project.

## Discussion points

Maybe there's a better alternative to `tsc-watch`? I briefly explored
some alternatives and while they had a much faster starting speed,
hot-reload was sometimes slower. IMO we should aspire to run
`src/server-dev.ts` directly and only compile when needed.

Running `dev:backend` still serves a version of the frontend (at 4242).
**Why? Can we remove that behavior?**
I can't imagine a scenario in dev where we wouldn't want to run the
latest version of the frontend with `vite`.

~~**Note:** This PR removes all other out-of-scope scripts to focus on
this revamp. If we decide to merge it, we should evaluate what other
existing scripts we still want to include. May be a good opportunity to
clean up unused ones and only include the ones we really use. This
includes scripts that our GH actions rely on.~~

**Update:** In an effort to minimize impact surface of this PR and make
it a bit more ready for merging:
- It updates some docs in
2a4ff805e8
and
1bbc488251
to reflect our new simplified flow;
- It includes the old package scripts for now in
039bc04699;
- It updates some of our GH actions to reflect the new scripts in
7782cb9b12;

Given its current status I'll promote the PR to "ready for review". 

I still think we should have a second look at our existing scripts and
GH actions to see what we really need and/or should adapt, but it should
be a team effort so we have a broader context. Maybe on a follow-up PR.

Does this require any changes to related projects (e.g. Enterprise)?

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-05-12 11:23:22 +01:00
Gastón Fournier
0426dd505d
chore: update to node 18 (#3527)
## About the changes
This upgrades our main branch to use node 18 which is the active LTS
version and stops using node 14 which reaches the end of life in a few
weeks: https://nodejs.dev/en/about/releases/

This PR also adds `--no-experimental-fetch` for frontend tests and other
frontend commands. Related to:
https://github.com/node-fetch/node-fetch/issues/1566

More about the experimental fetch release:
https://nodejs.org/en/blog/announcements/v18-release-announce#fetch-experimental
2023-04-18 10:35:32 +02:00
Gastón Fournier
8cdd68914e
chore: avoid building frontend when possible (#3278)
## About the changes
This is based on @nunogois suggestion to split the build in two, so we
don't build the frontend every time we run `yarn`

e2e frontend tests were forced to run by modifying frontend/README.md

### Important files
Some github actions had to be updated to also build the frontend. The
Dockerfile building our docker image was also looked into but it should
work as is


## Discussion points
This is a potentially risky operation as we might overlook something
that requires building the frontend which might lead to invalid builds.
We need to make sure when we do this we don't have any release planned.
2023-03-15 13:17:32 +01:00
sjaanus
a1ce89bedc
Merge frontend with backend (#1962)
* fix: use the frontend dir from the backend

* Build is now working

* Fix workflows

* Fix workflows

* Fix build PRs

* Test coverage workflow

* Test coverage

* Test coverage run

* Fix jest report

* refactor: add missing frontend build

* refactor: ignore frontend dir for coverage

* refactor: run frontend build in PRs

* refactor: run backend tests in PRs

* Revert "refactor: run backend tests in PRs"

This reverts commit 22cabddfd1.

* refactor: remove unused frontend build file

* refactor: test workflows in PR

* refactor: use a prepare script for the frontend

* refactor: simplify yarn build scripts

* refactor: fix check-release script

* Revert "refactor: test workflows in PR"

This reverts commit 496ae19404.

* refactor: remove unused gitignore lines

* refactor: remove renovate config from the frontend repo

* refactor: remove frontend repo license

* refactor: remove frontend repo changelog

* refactor: update frontend repo readme

* refactor: add frontend node_modules to dockerignore

* refactor: update the docker yarn.lock snapshot

Co-authored-by: olav <mail@olav.io>
2022-08-26 07:25:31 +00:00
Christopher Kolstad
90b72f1162
chore: update setup-node task to activate yarn cache (#1661) 2022-06-09 14:26:35 +02:00
renovate[bot]
86f03ed3a3
chore(deps): update actions/setup-node action to v3 (#1396)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-06 21:43:29 +02:00
renovate[bot]
19db5bb857
chore(deps): update actions/checkout action to v3 (#1407)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-06 21:43:00 +02:00
Ivar Conradi Østhus
14e09fe6aa
fix: modify actions for PRs 2021-10-06 22:16:58 +02:00
renovate[bot]
178c5aeaaa
chore(deps): update actions/setup-node action to v2 (#977)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-27 19:21:13 +02:00
Ivar Conradi Østhus
0eb132c025
feat: unleash v4 will require node 14 or higher (#784) 2021-04-13 09:22:37 +02:00
Christopher Kolstad
a67b50296b chore: setup separate workflow for PRs 2021-03-04 14:27:43 +01:00