Skip to content

Commit

Permalink
Merge branch 'add/BasePage_297_1_2' into add/Timeline_Tests_296_Tests…
Browse files Browse the repository at this point in the history
…_1_2
  • Loading branch information
DanLeshinsky authored Dec 26, 2023
2 parents 5c0733f + f956459 commit b32ce56
Show file tree
Hide file tree
Showing 80 changed files with 2,459 additions and 1,414 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# solves issues with stylis-plugin-rtl : https://github.com/styled-components/stylis-plugin-rtl/issues/35#issuecomment-1550877823
GENERATE_SOURCEMAP=false
GENERATE_SOURCEMAP=false
VITE_BASE_PATH=https://open-bus-stride-api.hasadna.org.il
20 changes: 20 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Lint PR'

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106 changes: 106 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Preview
on:
pull_request:

env:
ASSET_URL: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}
should_run: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
jobs:
should_run:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.set_should_run.outputs.should_run }}
steps:
- name: Set should_run
id: set_should_run
if: env.should_run
run: echo "::set-output name=should_run::true"

build:
runs-on: ubuntu-latest
needs: [should_run]
if: ${{ needs.should_run.outputs.should_run == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Build
run: yarn build
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
build-storybook:
runs-on: ubuntu-latest
needs: [should_run]
if: ${{ needs.should_run.outputs.should_run == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Build Storybook
run: yarn build-storybook -o dist/storybook
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
deploy-to-s3:
needs: [build, build-storybook]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: shallwefootball/s3-upload-action@master
name: Upload trace to S3
if: always()
id: s3-trace
continue-on-error: true
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: noam-gaash.co.il
source_dir: dist
destination_dir: ${{ github.run_id }}/open-bus/${{ github.sha }}
- name: find comment
uses: peter-evans/find-comment@v1
if: github.event_name == 'pull_request'
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Preview'
- name: update comment
uses: peter-evans/create-or-update-comment@v1
if: steps.fc.outputs.comment-id
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
Preview: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/index.html
Preview Storybook: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/storybook/index.html
- name: create comment
uses: peter-evans/create-or-update-comment@v1
if: steps.fc.outputs.comment-id == ''
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Preview: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/index.html
Preview Storybook: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/storybook/index.html
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
release-type: node
35 changes: 35 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,41 @@ jobs:
with:
name: playwright
path: test-results
- name: upload report
if: always()
uses: actions/upload-artifact@v2
with:
name: playwright
path: playwright-report
publish-test-results:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: playwright
path: test-results
- name: Publish test results
uses: shallwefootball/s3-upload-action@master
if: always()
id: s3-trace
continue-on-error: true
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: noam-gaash.co.il
source_dir: test-results
destination_dir: ${{ github.run_id }}/open-bus/${{ github.sha }}/test-results
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
description: 'Test results: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/test-results/index.html'
status: success
context: 'Test results'
targetUrl: 'https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/test-results/index.html'
test-unit:
timeout-minutes: 60
runs-on: ubuntu-latest
Expand Down
95 changes: 95 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Contribution Guidelines

Hello :wave: and welcome to **דאטאבוס**, a project of [hasadna](https://open-bus-map-search.hasadna.org.il)!

We glad to see you decided to contribute to our project!

[Join our discord](https://discord.gg/deBdkmufS4) to get connected with the project's development team.

# Where to start

You welcome to explore the [list of project's issues](https://github.com/hasadna/open-bus-map-search/issues), the points we need help with
Some of them marked with `help wanted` or `good first issue` - can be good for a beginners

Also! you can look at the project and if you find some point that can be improved (it can be unclear documentation as well as UI or backend problem) - you wellcome to add issue to the project issues (which considers a contribution too)

# Starting your environment

- Fork the Repository on GitHub (by pressing `fork` button)
- Clone the Repository on your machine (`git clone https://github.com/<YOUR NAME>/open-bus-map-search`)
- Define your fork as remote - `git remote set-url origin https://github.com/<YOUR NAME>/open-bus-map-search`
- Install dependencies `yarn`
- Run dev server `yarn start`

# How to open the PR

- If you're new to GitHub, here is a [tutorial describing Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
- create a branch
- branch better to be named after issue (or feature) it tries so solve, e.g. `feat/add-close-button-to-modal`
- Please make sure that the project works on your computer
- do changes and then - do commit (`git commit -m "feat: add some feature"`)
- push the branch to remote repo (`git push`)
- go to the original repo and create a pr (by pressing `create a pr` button)
- tag one of the maintainers as reviewers


# Commit message convention

- commit messages better to be short and explain clearly what the change is about
- `fix` change that tries to fix some bug, e.g. `fix: make close button visible at mobile`
- `feat` change that add some new functionality, e.g. `feat: add a modal component`
- `docs` change that adds some documentation, e.g. `docs: add project description at readme`
- `reafctor` change that makes the code better, e.g. `reafctor: split App component to subcomponents`
- `chore` all the other things `chore: upgrade react package to new 18 version`

## testing the project:

### tests beter to be run locally

| command | description |
| ------------------- | --------------------------------------------------------------- |
| `yarn test:unit` | Run the unit tests using `watch` option (good for development). |
| `yarn test:unit:ci` | Run the unit tests (good for ci). |
| `yarn test:e2e` | Run the e2e (playwright) tests (good for ci). |
| `yarn test:e2e:ui` | Run the e2e (playwright) tests with user interface. |
| `yarn test` | Run all the kind of tests. |

- additional helpful flags - https://playwright.dev/docs/test-cli

## useful resources:

- [the design file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0)
- [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
- [API documentation and examples (swagger)](https://open-bus-stride-api.hasadna.org.il/docs)
- [the deployed website](https://open-bus-map-search.hasadna.org.il/dashboard)

## Troubleshooting

we're here to help! feel free to join our [Slack channel](https://join.slack.com/t/hasadna/shared_invite/zt-21qipktl1-7yF4FYJVxAqXl0wE4DlMKQ)

# Related Repositories

- the API client
- the data API

## API client

The client is a JS library that provides methods and data models. for example:
https://github.com/hasadna/open-bus-map-search/blob/main/src/model/busStop.ts#L4
[link to repo](https://github.com/iliakap/open-bus-stride-client).

## data API

The API is backend code that provides us with data and aggregations from the DB
You can see it's endpoints here:
https://open-bus-stride-api.hasadna.org.il/docs
[link to repo](https://github.com/hasadna/open-bus-stride-api).

## FAQ

### Why do I get a red `x` commit status?

- lint - you have lint errors. fix them by running `yarn lint:fix`
- tests - you have test errors. see them by running `yarn test:unit:ci`
- build - you have build errors. see them by running `yarn build`
- pr title validation - you have an invalid pr title. please edit the title of your PR with conventional commit formatting. examples: `feat: add new feature`, `fix: fix a bug` or `docs: update README.md`
45 changes: 17 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
# Open bus ranking app

## Welcome!
This is the official repository of the open bus (תחב"צ פתוחה) project - also known as "ShameBus".
This is the official repository of the open bus (תחב"צ פתוחה / דאטאבוס) project - also known as "ShameBus".
[link to the project](https://open-bus-map-search.hasadna.org.il/dashboard)
- While in the site, type "storybook" (in lowercase) to see a secret 😉

Please feel free to submit pull requests and contribute to the project (see the "contribution" section).
Please feel free to submit pull requests and contribute to the project.
For more details about contributing, see the [CONTRIBUTION.md](CONTRIBUTION.md) file.

## View video (Hebrew language):
[![video (hebrew) about the project](https://img.youtube.com/vi/6H6jkJCVhgk/0.jpg)](https://www.youtube.com/watch?v=6H6jkJCVhgk)

## deployments

[![Netlify Status](https://api.netlify.com/api/v1/badges/d3ef62c2-b5bb-48ac-8299-71e5bd22b211/deploy-status)](https://app.netlify.com/sites/open-bus/deploys)

This app is created by the volunteers of [Public Knowledge Workshop](https://www.hasadna.org.il/)
# Easter eggs
We've hidden a couple of fun surprises in our web app, just for you. Discovering them is as easy as typing a few magic words on your keyboard.

## Contribution:
## How to Find the Easter Eggs
1. Open our [web app](https://open-bus-map-search.hasadna.org.il/dashboard)
2. **Unleash the Magic Words:**
To reveal the hidden gems, use your keyboard to type the following commands:

### Running the project:
- **Type "storybook":**
Watch the magic unfold as you type "storybook" on your keyboard. You might just stumble upon our Storybook, a treasure trove of UI components showcasing the beauty and functionality of our app.
- **Type "english":**
Feel like switching up the language? Type "english" and see the language toggle in action. Our app is multilingual, and you can experience it by triggering this secret command.
- **Type "geek":**
To get some experimental charts with some additional data and aggregation

- fork the repo
- clone the repo
- `yarn install`
- `yarn start`

### testing the project:
| command | description |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `yarn test:unit` | Run the unit tests using `watch` option (good for development). |
| `yarn test:unit:ci` | Run the unit tests (good for ci). |
| `yarn test:e2e` | Run the e2e (playwright) tests (good for ci). |
| `yarn test:e2e:ui` | Run the e2e (playwright) tests with user interface. |
| `yarn test` | Run all the kind of tests. |
- additional helpful flags - https://playwright.dev/docs/test-cli
## deployments

### useful resources:
* [the design file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0)
* [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
* [API documentation and examples (swagger)](https://open-bus-stride-api.hasadna.org.il/docs)
* [the deployed website](https://open-bus-map-search.hasadna.org.il/dashboard)
This app is created by the volunteers of [Public Knowledge Workshop](https://www.hasadna.org.il/)

### submitting pull requests
Thanks for your willingness to invest time and help us improve!
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@mui/x-date-pickers": "^6.12.1",
"@types/leaflet.markercluster": "^1.5.2",
"@vitejs/plugin-react-swc": "^3.4.0",
"antd": "^4.22.5",
"antd": "^5.12.2",
"axios": "^1.6.0",
"classnames": "^2.3.2",
"dayjs": "^1.11.9",
Expand Down
Loading

0 comments on commit b32ce56

Please sign in to comment.