Skip to content

Commit

Permalink
Dev (#810)
Browse files Browse the repository at this point in the history
* dev workflow update (#808)

* dev workflow update

* actions update

* workflow fixes, dev url fixes

* comment cypress testing

* env updates (#809)
  • Loading branch information
ahjyrkia committed May 24, 2024
1 parent b813d36 commit d0ac606
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 89 deletions.
12 changes: 6 additions & 6 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
REACT_APP_ENV_NAME=dev

REACT_APP_TRANSITLOG_SERVER=https://dev.reittiloki.hsl.fi/server/
REACT_APP_TRANSITLOG_SERVER_GRAPHQL=https://dev.reittiloki.hsl.fi/server/graphql/
REACT_APP_TRANSITLOG=https://dev.reittiloki.hsl.fi
REACT_APP_TRANSITLOG_SERVER=https://dev.reittiloki.hsldev.com/server/
REACT_APP_TRANSITLOG_SERVER_GRAPHQL=https://dev.reittiloki.hsldev.com/server/graphql/
REACT_APP_TRANSITLOG=https://dev.reittiloki.hsldev.com

# Auth
REACT_APP_AUTH_URI=https://hslid-uat.cinfra.fi/openid/auth
REACT_APP_CLIENT_ID=7510123698297597
REACT_APP_REDIRECT_URI=https://dev.reittiloki.hsl.fi
REACT_APP_REDIRECT_URI=https://dev.reittiloki.hsldev.com
REACT_APP_AUTH_SCOPE=email+https://oneportal.trivore.com/scope/groups.readonly

# Change this to false in production.
REACT_APP_ALLOW_DEV_LOGIN=false

# The current production URL. Update when/if it changes.
REACT_APP_PRODUCTION_URL=https://dev.reittiloki.hsl.fi
REACT_APP_PRODUCTION_URL=https://dev.reittiloki.hsldev.com

# The timezone for all dates and times in the app. For HSL this should be
# Europe/Helsinki since all scehdules are in Finnish time. Change this
Expand All @@ -27,4 +27,4 @@ REACT_APP_FMI_APIKEY=4a22a195-10be-404f-8056-e8aaf5f7506a

REACT_APP_DIGITRANSIT_URL=https://api.digitransit.fi/
REACT_APP_MAPILLARY_CLIENT_TOKEN=MLY|4648891498509284|8e5e3395c54d64ca14b62c79ceb3e16c
REACT_APP_DIGITRANSIT_API_KEY=
REACT_APP_DIGITRANSIT_API_KEY=ca9e1c9b7fcf49358a0f0e2c2e599cd4
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ REACT_APP_FMI_APIKEY=4a22a195-10be-404f-8056-e8aaf5f7506a

REACT_APP_DIGITRANSIT_URL=https://api.digitransit.fi/
REACT_APP_MAPILLARY_CLIENT_TOKEN=MLY|4699140670124156|c0617576966bc69ea39fb284a78df199
REACT_APP_DIGITRANSIT_API_KEY=
REACT_APP_DIGITRANSIT_API_KEY=ca9e1c9b7fcf49358a0f0e2c2e599cd4
117 changes: 53 additions & 64 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-ui
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
buildargs: BUILD_ENV=dev
tags: date-${{ steps.date.outputs.date }}
- name: Build UI and publish Docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-ui
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
buildargs: BUILD_ENV=dev
tags: dev
- name: Checkout server
Expand All @@ -39,69 +39,58 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-server
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
tags: dev
- name: Build Server and publish timestamped Docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-server
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
tags: date-${{ steps.date.outputs.date }}
- name: Deploy with Gitlab CI
run: curl -X POST -F token=${{ secrets.GITLAB_DEV_TRIGGER_TOKEN }} -F ref=master https://gitlab.hsl.fi/api/v4/projects/202/trigger/pipeline
- name: Notify of deployment
uses: 8398a7/action-slack@v2
if: always()
with:
status: ${{ job.status }}
text: Reittiloki DEV deployment status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
test-dev:
needs: deploy-dev
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v2
with:
node-version: "14"
- uses: actions/checkout@v2
with:
ref: dev
- name: Sleep for 5 minutes
uses: jakejarvis/wait-action@master
with:
time: "5m"
- name: Cypress tests
uses: cypress-io/github-action@v2
with:
node-version: "14"
env:
CYPRESS_BASE_URL: https://dev.reittiloki.hsl.fi
CYPRESS_CLIENT_ID: ${{ secrets.CYPRESS_CLIENT_ID }}
CYPRESS_CLIENT_SECRET: ${{ secrets.CYPRESS_CLIENT_SECRET }}
CYPRESS_HSL_TESTING_HSLID_USERNAME: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_USERNAME }}
CYPRESS_HSL_TESTING_HSLID_PASSWORD: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_PASSWORD }}
- name: Upload screenshot artifacts
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Upload video artifacts
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-videos
path: cypress/videos
- name: Notify of tests
uses: 8398a7/action-slack@v2
if: failure()
with:
status: ${{ job.status }}
text: Reittiloki DEV E2E test status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# test-dev:
# needs: deploy-dev
# runs-on: ubuntu-latest
# steps:
# - uses: actions/setup-node@v2
# with:
# node-version: "14"
# - uses: actions/checkout@v2
# with:
# ref: dev
# - name: Sleep for 5 minutes
# uses: jakejarvis/wait-action@master
# with:
# time: "5m"
# - name: Cypress tests
# uses: cypress-io/github-action@v2
# with:
# node-version: "14"
# env:
# CYPRESS_BASE_URL: https://dev.reittiloki.hsldev.com
# CYPRESS_CLIENT_ID: ${{ secrets.CYPRESS_CLIENT_ID }}
# CYPRESS_CLIENT_SECRET: ${{ secrets.CYPRESS_CLIENT_SECRET }}
# CYPRESS_HSL_TESTING_HSLID_USERNAME: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_USERNAME }}
# CYPRESS_HSL_TESTING_HSLID_PASSWORD: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_PASSWORD }}
# - name: Upload screenshot artifacts
# uses: actions/upload-artifact@v1
# if: failure()
# with:
# name: cypress-screenshots
# path: cypress/screenshots
# - name: Upload video artifacts
# uses: actions/upload-artifact@v1
# if: failure()
# with:
# name: cypress-videos
# path: cypress/videos
# - name: Notify of tests
# uses: 8398a7/action-slack@v2
# if: failure()
# with:
# status: ${{ job.status }}
# text: Reittiloki DEV E2E test status
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
8 changes: 4 additions & 4 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-ui
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
buildargs: BUILD_ENV=production
tags: production
- name: Checkout server
Expand All @@ -29,8 +29,8 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/transitlog-server
username: ddunderfelt
password: ${{ secrets.DDUNDERFELT_DOCKER_ACCESS_TOKEN }}
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }}
tags: production
- name: Deploy with Gitlab CI
run: curl -X POST -F token=${{ secrets.GITLAB_PROD_TRIGGER_TOKEN }} -F ref=master https://gitlab.hsl.fi/api/v4/projects/233/trigger/pipeline
Expand Down
2 changes: 1 addition & 1 deletion .graphqlconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"headers": { "user-agent": "JS GraphQL" }
},
"Transitlog server dev": {
"url": "https://dev.reittiloki.hsl.fi/server/graphql",
"url": "https://dev.reittiloki.hsldev.com/server/graphql",
"method": "POST",
"introspect": true,
"headers": { "user-agent": "JS GraphQL" }
Expand Down
2 changes: 1 addition & 1 deletion cypress.dev.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"baseUrl": "https://dev.reittiloki.hsl.fi"
"baseUrl": "https://dev.reittiloki.hsldev.com"
}
6 changes: 4 additions & 2 deletions src/components/journeypanel/JourneyPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ const JourneyPanel = decorate(
}
}, [selectedJourney, loading]);

const journeyMode = get(route, "mode", "BUS");
let journeyMode = get(route, "mode", "BUS");
if (route.trunkRoute) {
journeyMode = "TRUNK";
}
const journeyColor = get(transportColor, journeyMode, "var(--light-grey)");
const originDeparture = get(journey, "departure", null);
const journeyEvents = get(journey, "events", []);

const journeyHealth = useJourneyHealth(journey);
const dataDelay = useDataDelay(journey);

Expand Down
10 changes: 8 additions & 2 deletions src/components/map/MapContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,20 @@ const MapContent = decorate(
<TerminalLayer />
{hasRoute && (
<>
<RouteLayer canCenterOnRoute={centerOnRoute} />
<RouteLayer
canCenterOnRoute={centerOnRoute}
isTrunkRoute={route.trunkRoute}
/>

{mapOverlays.includes("Route segment length") && <RouteSegmentLengthLayer />}

{(!selectedJourneyId ||
journeys.length === 0 ||
!journeys.find((journey) => selectedJourneyId === journey.id)) && (
<RouteStopsLayer showRadius={showStopRadius} />
<RouteStopsLayer
showRadius={showStopRadius}
isTrunkRoute={route.trunkRoute}
/>
)}

{journeys.length !== 0 &&
Expand Down
9 changes: 5 additions & 4 deletions src/components/map/RouteLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const routeGeometryQuery = gql`

const decorate = flow(observer, inject("UI"));

const RouteLayer = decorate(({canCenterOnRoute, UI, state}) => {
const RouteLayer = decorate(({canCenterOnRoute, isTrunkRoute, UI, state}) => {
const {route, date} = state;

const {data: routeGeometry} = useQueryData(
Expand All @@ -39,10 +39,11 @@ const RouteLayer = decorate(({canCenterOnRoute, UI, state}) => {
},
"route geometry query"
);

const coordinates = get(routeGeometry, "coordinates", []);
const mode = get(routeGeometry, "mode", []);

let mode = get(routeGeometry, "mode", []);
if (isTrunkRoute) {
mode = "TRUNK";
}
useEffect(() => {
if (!route || !route.routeId || !canCenterOnRoute || coordinates.length === 0) {
return;
Expand Down
7 changes: 5 additions & 2 deletions src/components/map/RouteStop.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const RouteStop = decorate(
selectedJourney,
journey,
showRadius,
isTrunkRoute,
state,
Filters,
Time,
Expand All @@ -74,7 +75,6 @@ const RouteStop = decorate(
},
[]
);

const onShowStreetView = useCallback(() => {
UI.setMapillaryViewerLocation(latLng({lat: stop.lat, lng: stop.lng}));
}, [stop]);
Expand Down Expand Up @@ -102,7 +102,10 @@ const RouteStop = decorate(

let markerChildren = [stopTooltip, stopStreetViewPopup];

const mode = getPriorityMode(get(stop, "modes", []));
let mode = getPriorityMode(get(stop, "modes", []));
if (isTrunkRoute) {
mode = "TRUNK";
}
let color = getModeColor(mode);

if (!selectedJourney || (!departure && !arrival)) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/map/RouteStopsLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import get from "lodash/get";
const decorate = flow(observer, inject("state"));

const RouteStopsLayer = decorate(
({state: {date, route, selectedJourney}, showRadius}) => {
({state: {date, route, selectedJourney}, showRadius, isTrunkRoute}) => {
let {data: routeStopsData} = useQueryData(stopsByRouteQuery, {
skip: !route,
variables: {
Expand All @@ -21,7 +21,6 @@ const RouteStopsLayer = decorate(
});

let routeStops = routeStopsData || [];

return routeStops.map((stop, index, arr) => {
const isFirst = index === 0;
const isLast = index === arr.length - 1;
Expand All @@ -37,6 +36,7 @@ const RouteStopsLayer = decorate(
stop={stop}
date={date}
showRadius={showRadius}
isTrunkRoute={isTrunkRoute}
/>
);
});
Expand Down

0 comments on commit d0ac606

Please sign in to comment.