Skip to content

Commit

Permalink
Merge pull request #301 from geoadmin/develop
Browse files Browse the repository at this point in the history
New Release v0.2.0 - #minor
  • Loading branch information
ltshb authored Nov 22, 2022
2 parents 3fd6486 + 3620225 commit c28d110
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 31 deletions.
1 change: 1 addition & 0 deletions .env → .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ VITE_WMTS_BASE_URL=https://sys-wmts.dev.bgdi.ch/
VITE_WMS_BASE_URL=https://sys-wms.dev.bgdi.ch/
VITE_API_SERVICES_BASE_URL=https://sys-map.dev.bgdi.ch/api/
VITE_API_SERVICE_KML_BASE_URL=https://sys-public.dev.bgdi.ch/
VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://sys-public.dev.bgdi.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://sys-s.dev.bgdi.ch/
1 change: 1 addition & 0 deletions .env.integration
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ VITE_WMTS_BASE_URL=https://sys-wmts.int.bgdi.ch/
VITE_WMS_BASE_URL=https://sys-wms.int.bgdi.ch/
VITE_API_SERVICES_BASE_URL=https://sys-map.int.bgdi.ch/api/
VITE_API_SERVICE_KML_BASE_URL=https://sys-public.int.bgdi.ch/
VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://sys-public.int.bgdi.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://sys-s.int.bgdi.ch/
14 changes: 7 additions & 7 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
VITE_APP_API_BASE_URL=https://api3.geo.admin.ch/
VITE_API_BASE_URL=https://api3.geo.admin.ch/
VITE_API_SERVICE_ALTI_BASE_URL=https://api3.geo.admin.ch/
VITE_API_SERVICE_SEARCH_BASE_URL=https://api3.geo.admin.ch/
VITE_APP_API_PUBLIC_URL=https://public.geo.admin.ch/
VITE_APP_DATA_BASE_URL=https://data.geo.admin.ch/
VITE_APP_WMTS_BASE_URL=https://wmts.geo.admin.ch/
VITE_APP_WMS_BASE_URL=https://wms.geo.admin.ch/
VITE_APP_API_SERVICES_BASE_URL=https://map.geo.admin.ch/
VITE_APP_API_SERVICE_KML_BASE_URL=https://public.geo.admin.ch/
VITE_DATA_BASE_URL=https://data.geo.admin.ch/
VITE_WMTS_BASE_URL=https://wmts.geo.admin.ch/
VITE_WMS_BASE_URL=https://wms.geo.admin.ch/
VITE_API_SERVICES_BASE_URL=https://map.geo.admin.ch/api/
VITE_API_SERVICE_KML_BASE_URL=https://public.geo.admin.ch/
VITE_API_SERVICE_KML_STORAGE_BASE_URL=https://public.geo.admin.ch/
VITE_APP_API_SERVICE_SHORTLINK_BASE_URL=https://s.geo.admin.ch/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DS_Store
node_modules
/dist
dist/

# local env files
.env.local
Expand Down
41 changes: 32 additions & 9 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,20 @@ phases:
export GIT_BRANCH=${GIT_BRANCH##*/}
fi
# if this build has been triggered by a push on master (PR merge on master), we deploy on INT (otherwise everything goes to dev)
- export BUILD_TYPE=dev
- export DEPLOY_TARGET="dev"
- if [ "${GIT_BRANCH}" = "master" ] ; then
- export BUILD_TYPE_1=dev
- export BUILD_OUTPUT_1=development
- export BUILD_TYPE_2=dev
- export BUILD_OUTPUT_2=development
- if [[ "${GIT_BRANCH}" == "master" ]]; then
export DEPLOY_TARGET="int";
export BUILD_TYPE=prod;
export BUILD_TYPE_1=int;
export BUILD_OUTPUT_1=integration;
export BUILD_TYPE_2=prod;
export BUILD_OUTPUT_2=production;
elif [[ "${GIT_BRANCH}" == "develop" ]]; then
export BUILD_TYPE_2=int;
export BUILD_OUTPUT_2=integration;
fi
# if we are on DEV, we have to switch to the account "swisstopo-bgdi-dev", otherwise the account is "swisstopo-bgdi"
- export AWS_ACCOUNT_TO_USE="${AWS_SWISSTOPO_BGDI_DEV_ACCOUNT_ID}:role/BgdiDevCodebuildAccess"
Expand All @@ -75,7 +84,10 @@ phases:
- echo GIT_HASH=${GIT_HASH}
- echo GIT_TAG=${GIT_TAG}
- echo GIT_DIRTY=${GIT_DIRTY}
- echo BUILD_TYPE=${BUILD_TYPE}
- echo BUILD_TYPE_1=${BUILD_TYPE_1}
- echo BUILD_TYPE_2=${BUILD_TYPE_2}
- echo BUILD_OUTPUT_2=${BUILD_OUTPUT_2}
- echo BUILD_OUTPUT_1=${BUILD_OUTPUT_1}
- echo DEPLOY_TARGET=${DEPLOY_TARGET}
- echo AWS_ACCOUNT_TO_USE=${AWS_ACCOUNT_TO_USE}
- echo APP_VERSION=${GIT_TAG}
Expand All @@ -85,8 +97,13 @@ phases:
build:
commands:
- echo ===================================================================
- echo Building application for ${BUILD_TYPE}
- npm run build-${BUILD_TYPE}
- echo Building application for ${BUILD_TYPE_1}
- npm run build:${BUILD_TYPE_1}
- if [[ "${BUILD_TYPE_1}" != "${BUILD_TYPE_2}" ]]; then
echo -------------------------------------------------------------------;
echo Building application for ${BUILD_TYPE_2};
npm run build:${BUILD_TYPE_2};
fi


post_build:
Expand All @@ -105,13 +122,19 @@ phases:
- echo ===================================================================
- echo E2E Testings...
# will build the application in dev mode before testing
- CYPRESS_CACHE_FOLDER=/tmp/.cache npm run test:e2e:ci
- CYPRESS_CACHE_FOLDER=/tmp/.cache npm run test:e2e:ci:${BUILD_TYPE_1}
- echo DONE


artifacts:
# The name below is only used for manual build (not by build started by the webhook)
name: ${BUILD_TYPE}/web-mapviewer/${APP_VERSION}
name: ${BUILD_TYPE_1}/web-mapviewer/${APP_VERSION}
files:
- '**/*'
base-directory: dist
base-directory: dist/${BUILD_OUTPUT_1}
secondary-artifacts:
production:
name: ${BUILD_TYPE_2}/web-mapviewer/${APP_VERSION}
files:
- '**/*'
base-directory: dist/${BUILD_OUTPUT_2}
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ module.exports = defineConfig({
},
baseUrl: 'http://localhost:8080',
specPattern: 'tests/e2e-cypress/integration/**/*.*',
supportFile: 'tests/e2e-cypress/support/index.js',
supportFile: 'tests/e2e-cypress/support/index.js'
},
})
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@
"scripts": {
"start": "npm run dev",
"dev": "vite --port 8080",
"preview": "vite build && vite preview --port 8080",
"preview": "npm run build:prod && vite preview --port 8080 --outDir dist/production",
"preview:dev": "npm run build:dev && vite preview --port 8080 --outDir dist/development",
"test:unit": "vitest --run --environment jsdom",
"test:unit:watch": "vitest --environment jsdom",
"test:e2e": "start-server-and-test dev 8080 'cypress open'",
"test:e2e:tablet": "start-server-and-test preview 8080 'cypress open --config viewportWidth=768,viewportHeight=1024'",
"test:e2e:desktop": "start-server-and-test preview 8080 'cypress open --config viewportWidth=1440,viewportHeight=900'",
"test:e2e:ci": "start-server-and-test preview 8080 'cypress run'",
"test:e2e:ci:dev": "start-server-and-test preview:dev 8080 'cypress run'",
"test:e2e:ci:prod": "npm run test:e2e:ci",
"test:ci": "npm run test:unit && npm run test:e2e:ci",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"build": "npm run type-check && vite build",
"build-dev": "npm run build -- --mode development",
"build-prod": "npm run build -- --mode production",
"build:dev": "npm run build -- --mode development",
"build:int": "npm run build -- --mode integration",
"build:prod": "npm run build -- --mode production",
"deploy:dev": "node scripts/deploy.js dev",
"deploy:int": "node scripts/deploy.js int",
"update:translations": "node scripts/generate-i18n-files.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const s3Utils = require('./s3-utils')
const fileUtils = require('./file-utils')

// Checking if index.html file is present in dist folder (if build has been done beforehand)
if (!fileUtils.fileExists('./dist/index.html')) {
if (!fileUtils.fileExists('./dist/development/index.html')) {
console.error('Please build the project before trying to deploy')
process.exit(1)
}
Expand Down Expand Up @@ -114,7 +114,7 @@ s3Utils
bucketFolder = branch
}

const distFolderRelativePath = './dist/'
const distFolderRelativePath = './dist/development'
const distFolderFullPath = resolve(distFolderRelativePath)

let countFileBeingUploaded = 0
Expand Down
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const API_SERVICES_BASE_URL = enforceEndingSlashInUrl(
* @type String
*/
export const API_SERVICE_KML_BASE_URL = enforceEndingSlashInUrl(
import.meta.env.VITE_API_SERVICE_KML_BASE_URL || API_PUBLIC_URL
import.meta.env.VITE_API_SERVICE_KML_BASE_URL
)

/**
Expand All @@ -108,7 +108,7 @@ export const API_SERVICE_KML_BASE_URL = enforceEndingSlashInUrl(
* @type String
*/
export const API_SERVICE_KML_STORAGE_BASE_URL = enforceEndingSlashInUrl(
import.meta.env.VITE_API_SERVICE_KML_STORAGE_BASE_URL || API_SERVICE_KML_BASE_URL
import.meta.env.VITE_API_SERVICE_KML_STORAGE_BASE_URL
)

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-cypress/fixtures/service-kml/lonelyMarker.kml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Style />
<ExtendedData>
<Data name="editableFeature">
<value>{"id":"drawing_feature_149","coordinates":[[852274.1196923893,5923114.175634811]],"title":"A not interesting comment","description":"","featureType":"MARKER","textColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"textSize":{"label":"medium_size","textScale":1.5,"iconScale":1},"fillColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"icon":{"name":"001-marker","imageURL":"https://sys-map.dev.bgdi.ch/api/icons/sets/default/icons/001-marker%401x-255%2C0%2C0.png","imageTemplateURL":"https://sys-map.dev.bgdi.ch/api/icons/sets/{icon_set_name}/icons/{icon_name}@{icon_scale}-{r},{g},{b}.png","iconSetName":"default","anchor":[0.5,0.875]},"iconSize":{"label":"medium_size","textScale":1.5,"iconScale":1}}</value>
<value>{"id":"drawing_feature_149","coordinates":[[852274.1196923893,5923114.175634811]],"title":"A not interesting comment","description":"","featureType":"MARKER","textColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"textSize":{"label":"medium_size","textScale":1.5,"iconScale":1},"fillColor":{"name":"red","fill":"#ff0000","border":"#ffffff"},"icon":{"name":"001-marker","imageURL":"https://map.geo.admin.ch/api/icons/sets/default/icons/001-marker%401x-255%2C0%2C0.png","imageTemplateURL":"https://map.geo.admin.ch/api/icons/sets/{icon_set_name}/icons/{icon_name}@{icon_scale}-{r},{g},{b}.png","iconSetName":"default","anchor":[0.5,0.875]},"iconSize":{"label":"medium_size","textScale":1.5,"iconScale":1}}</value>
</Data>
<Data name="type">
<value>point</value>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/e2e-cypress/integration/drawing/kml.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Drawing loading KML', () => {
it('load kml file, open drawing mode and try to delete a feature', () => {
//load map with an injected kml layer containing a text
const kmlFileId = 'test-fileID12345678900'
const kmlUrlParam = `KML|https://sys-public.dev.bgdi.ch/api/kml/files/${kmlFileId}|Dessin`
const kmlUrlParam = `KML|https://public.geo.admin.ch/api/kml/files/${kmlFileId}|Dessin`
cy.intercept(`**/api/kml/files/${kmlFileId}`, {
fixture: 'service-kml/lonelyMarker.kml',
}).as('initialKmlFile')
Expand All @@ -85,7 +85,7 @@ describe('Drawing loading KML', () => {
.should('have.length', 1)
//click on the delete button
cy.get('[data-cy="drawing-style-delete-button"]').click()
//ckeck that the text was correctly deleted
//check that the text was correctly deleted
cy.readStoreValue('state.features.selectedFeatures').should('have.length', 0)
cy.readStoreValue('state.drawing.featureIds').should('have.length', 0)
cy.readWindowValue('drawingLayer')
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e-cypress/integration/mouseposition.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ describe('Test mouse position', () => {
const lon = 8
beforeEach(() => {
// Viewport set to see the whole popup
cy.intercept(`**/api/qrcode/generate**`, {
fixture: 'service-qrcode/position-popup.png',
}).as('qrcode')
cy.viewport(320, 1000)
cy.goToMapView('en', { lat, lon })
cy.get('[data-cy="map"]').rightclick()
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e-cypress/integration/shareShortLink.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ describe('Testing the share menu', () => {
cy.get('[data-cy="menu-button"]').click()
// intercepting short link requests, in order not to have to import the config
// we check only for the first part of the URL (without the staging)
cy.intercept('https://s.geo.admin.ch**', { body: { shorturl: dummyShortLink } }).as(
'shortLink'
)
cy.intercept('POST', /^https?:\/\/(sys-s\.\w+\.bgdi\.ch|s\.geo\.admin\.ch)\//, {
body: { shorturl: dummyShortLink },
}).as('shortLink')
})
context('Short link generation', () => {
it('Does not generate a short link at startup', () => {
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default defineConfig(({ command, mode }) => {
build: {
emptyOutDir: true,
assetsDir: `${appVersion}/assets`,
outDir: `./dist/${mode}`
},
plugins: [vue(), generateBuildInfo(appVersion)],
resolve: {
Expand Down

0 comments on commit c28d110

Please sign in to comment.