Skip to content

Commit

Permalink
Merge pull request #141 from patou/preprod/release-ng5
Browse files Browse the repository at this point in the history
Preprod/release V7 ng5 Front in Angular
  • Loading branch information
patou authored Nov 8, 2020
2 parents bf05764 + d9e1594 commit d867e86
Show file tree
Hide file tree
Showing 382 changed files with 72,830 additions and 2,067 deletions.
138 changes: 138 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
version: 2.1 # use CircleCI 2.0
jobs: # a collection of steps
build-frontend:
working_directory: ~/liste-envies
docker:
- image: circleci/node:12.18.4
steps:
- checkout
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: yarn-packages-{{ checksum "liste-envies-front/yarn.lock" }}
- run: cd liste-envies-front && yarn install --frozen-lockfile
- save_cache: # special step to save the dependency cache
key: yarn-packages-{{ checksum "liste-envies-front/yarn.lock" }}
paths:
- ~/.cache/yarn
- run: cd liste-envies-front && yarn run build
- persist_to_workspace:
root: ~/liste-envies
paths:
- liste-envies-front/dist
- store_artifacts:
path: liste-envies-front/dist
build-backend: # runs not using Workflows must have a `build` job as entry point
working_directory: ~/liste-envies
docker:
- image: circleci/openjdk:8-jdk-stretch
steps:
- checkout
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: java-{{ checksum "liste-envies-war/pom.xml" }}
- run: cd liste-envies-war && mvn dependency:go-offline # gets the project dependencies
- save_cache: # saves the project dependencies
paths:
- ~/.m2
key: java-{{ checksum "liste-envies-war/pom.xml" }}
- run: echo ${FIREBASE_SERVICE_TEST_ACCOUNT} > liste-envies-war/src/main/resources/firebase.json
- run: cd liste-envies-war && mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error clean test
- run:
name: Save test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always
- persist_to_workspace:
root: ~/liste-envies
paths:
- liste-envies-war/target/liste-envies
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/junit
deploy-test:
working_directory: ~/liste-envies
docker:
- image: circleci/openjdk:8-jdk-stretch
steps:
- checkout
- attach_workspace:
at: ~/liste-envies
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: java-{{ checksum "liste-envies-war/pom.xml" }}
- run:
name: Install Gcloud
command: |
if [ ! -d "~/google-cloud-sdk/bin" ]; then rm -rf ~/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
source ~/google-cloud-sdk/path.bash.inc
gcloud version
gcloud --quiet components update app-engine-java
- run:
name: Deploy Apps
command: |
source ~/google-cloud-sdk/path.bash.inc
cd liste-envies-war
echo ${FIREBASE_SERVICE_ACCOUNT_TEST} > src/main/resources/firebase.json
echo ${GOOGLE_CLIENT_SECRET_TEST} > client-secret.json;
export APP_ID=${CLOUDSDK_PROJECT_TEST};
BRANCH=${CIRCLE_BRANCH//[^a-zA-Z0-9]/-}
export APP_VERSION=${BRANCH:0:63};
echo "Deploy application ${APP_ID} version ${APP_VERSION}"
gcloud auth activate-service-account --key-file client-secret.json
mvn -B --no-transfer-progress -DskipTests=true -Dapp.deploy.projectId=${APP_ID} -Dapp.deploy.version=${APP_VERSION} -Dapp.deploy.promote=false package appengine:deployAll
deploy-prod:
working_directory: ~/liste-envies
docker:
- image: circleci/openjdk:8-jdk-stretch
steps:
- checkout
- attach_workspace:
at: ~/liste-envies
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: java-{{ checksum "liste-envies-war/pom.xml" }}
- run:
name: Install Gcloud
command: |
if [ ! -d "~/google-cloud-sdk/bin" ]; then rm -rf ~/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
source ~/google-cloud-sdk/path.bash.inc
gcloud version
gcloud --quiet components update app-engine-java
- run:
name: Deploy Apps
command: |
source ~/google-cloud-sdk/path.bash.inc
cd liste-envies-war
echo ${FIREBASE_SERVICE_ACCOUNT} > src/main/resources/firebase.json
echo ${GOOGLE_CLIENT_SECRET} > client-secret.json;
export APP_ID=${CLOUDSDK_PROJECT};
export APP_VERSION=${MASTER_VERSION:0:63};
echo "Deploy application ${APP_ID} version ${APP_VERSION}"
gcloud auth activate-service-account --key-file client-secret.json
mvn -B --no-transfer-progress -DskipTests=true -Dapp.deploy.projectId=${APP_ID} -Dapp.deploy.version=${APP_VERSION} -Dapp.deploy.promote=false package appengine:deployAll
workflows:
version: 2
build-test-and-deploy:
jobs:
- build-frontend
- build-backend
- deploy-test:
requires:
- build-frontend
- build-backend
filters:
branches:
ignore: master
- deploy-prod:
requires:
- build-frontend
- build-backend
filters:
branches:
only:
- master
- /preprod\/.*/
- /beta\/.*/
22 changes: 22 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ci:
- ./.github/workflows/*
- ./.github/*
- .circleci/*
- .travis.yml
repo:
- ./*
back:
- liste-envies-war/src/*
- liste-envies-war/src/**/*
front:
- liste-envies-front/src/*
- liste-envies-front/src/**/*
style:
- liste-envies-front/**/*.scss
- liste-envies-front/**/*.css
test:
- liste-envies-front/**/*.spec.ts
- liste-envies-war/src/test/**/*.java
dependencies:
- liste-envies-front/package.json
- liste-envies-war/pom.xml
20 changes: 20 additions & 0 deletions .github/workflows/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Supression d'une branche

on:
pull_request:
types: [closed]

jobs:
removeversion:
name: Suppression d'une branche
runs-on: ubuntu-latest
steps:
- uses: rlespinasse/[email protected]
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: "277.0.0"
service_account_key: ${{ secrets.GCP_SA_KEY }}
- run: |
APP_VERSION=${{ env.GITHUB_HEAD_REF_SLUG }}
echo Delete version ${APP_VERSION}
gcloud app versions delete --project test-liste-envies ${APP_VERSION}
18 changes: 18 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md

name: Labeler
on: [pull_request]

jobs:
label:
runs-on: ubuntu-latest

steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
31 changes: 31 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Add url on PR

on: [pull_request]

jobs:
commentpr:
runs-on: [ubuntu-latest]
steps:
- name: "Wait for status checks"
id: waitforstatuschecks
uses: "WyriHaximus/[email protected]"
with:
ignoreActions: commentpr
checkInterval: 13
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: rlespinasse/[email protected]
- uses: mshick/add-pr-comment@v1
if: steps.waitforstatuschecks.outputs.status == 'success'
with:
message: |
Application deployé sur https://${{ env.GITHUB_HEAD_REF_SLUG }}-dot-test-liste-envies.appspot.com/ (http://${{ env.GITHUB_HEAD_REF_SLUG }}.test-liste-envies.appspot.com/)
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false
- name: Slack notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_AVATAR: repository # Optional. can be (repository, sender, an URL) (defaults to webhook app avatar)
uses: Ilshidur/action-slack@master
with:
args: "Voir l'application deployé sur https://{{ GITHUB_HEAD_REF_SLUG }}-dot-test-liste-envies.appspot.com/"
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,20 @@ liste-envies-war/.classpath
.project
.classpath
.settings
pubspec.lock
.c9
.idea/
.settings/
*.swo
modules/.settings
.vscode
modules/.vscode

# Ignore npm/yarn debug log
npm-debug.log
yarn-error.log

# Front files
liste-envies-front/dist/
liste-envies-front/node_modules/
liste-envies-front/documentation/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.18.4
82 changes: 53 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
language: java
cache:
directories:
- $HOME/.m2
- $HOME/google-cloud-sdk
install:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud version
- gcloud --quiet components update app-engine-java
jobs:
include:
- language: java
name: "Backend"
stage: build
cache:
directories:
- $HOME/.m2
- $HOME/google-cloud-sdk
install:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud version
- gcloud --quiet components update app-engine-java

#command to install dependencies
script:
- cd liste-envies-war
- "mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error clean install"
#command to install dependencies
script:
- cd $TRAVIS_BUILD_DIR/liste-envies-war
- echo ${FIREBASE_SERVICE_ACCOUNT} > $TRAVIS_BUILD_DIR/liste-envies-war/src/main/resources/firebase.json
- "mvn -B --no-transfer-progress -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error clean test"

- language: node_js
stage: build
name: "Frontend"
node_js:
- 12
cache:
directories:
- $TRAVIS_BUILD_DIR/liste-envies-front/node_modules
install:
- cd $TRAVIS_BUILD_DIR/liste-envies-front
- npm install

#command to install dependencies
script:
- cd $TRAVIS_BUILD_DIR/liste-envies-front
- npm run build
- language: java
stage: deploy
name: "Deploy"
script:
- cd $TRAVIS_BUILD_DIR/liste-envies-war
- if [ a${TRAVIS_BRANCH} = "amaster" -a ${TRAVIS_EVENT_TYPE} = "push" ]; then
echo ${GOOGLE_CLIENT_SECRET} > client-secret.json;
export APP_ID=${CLOUDSDK_CORE_PROJECT};
export APP_VERSION=${VERSION_CORE_NAME};
else
echo ${GOOGLE_CLIENT_SECRET_TEST} > client-secret.json;
export APP_ID=${CLOUDSDK_TEST_PROJECT};
export APP_VERSION=${TRAVIS_BRANCH//_/-};
fi
- echo "Deploy application ${APP_ID} version ${APP_VERSION}"
- gcloud auth activate-service-account --key-file client-secret.json
- mvn -B -DskipTests=true -Dapp.deploy.project=${APP_ID} -Dapp.deploy.version=${APP_VERSION} -Dapp.deploy.promote=false appengine:deploy

#command to deploy
after_success:
- if [ a${TRAVIS_BRANCH} = "amaster" -a ${TRAVIS_EVENT_TYPE} = "push" ]; then
echo ${GOOGLE_CLIENT_SECRET} > client-secret.json;
export APP_ID=${CLOUDSDK_CORE_PROJECT};
export APP_VERSION=${VERSION_CORE_NAME};
else
echo ${GOOGLE_CLIENT_SECRET_TEST} > client-secret.json;
export APP_ID=${CLOUDSDK_TEST_PROJECT};
export APP_VERSION=${TRAVIS_BRANCH//_/-};
fi
- echo "Deploy application ${APP_ID} version ${APP_VERSION}"
- gcloud auth activate-service-account --key-file client-secret.json
- mvn -B -DskipTests=true -Dapp.deploy.project=${APP_ID} -Dapp.deploy.version=${APP_VERSION} appengine:deploy

notifications:
slack: desaintsteban:OBrvC8hmnZXdW1HTa0QOE5tM
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@ Application pour créer la liste de ces envies, et la partager avec notre famill

The application use :
- Google App Engine
- Angular JS
- [Start Bootstrap Admin](https://github.com/IronSummitMedia/startbootstrap-sb-admin)
- Angular
- Angular Material
- Sass


# Deployement :

* In travis environnement variable add theses var :
* CLOUDSDK_CORE_PROJECT : Production app engine project id
* CLOUDSDK_TEST_PROJECT : Test app engine project id
* FIREBASE_SERVICE_ACCOUNT : The firebase service account private key in the JSON format (add '' arrount the json content)
* GOOGLE_CLIENT_SECRET : Production app engine deploy private key (add '' arrount the json content)
* GOOGLE_CLIENT_SECRET_TEST : Production app engine deploy private key (add '' arrount the json content)
* VERSION_CORE_NAME : Version of the production application (master branch), in test, the version is the branch name.
13 changes: 13 additions & 0 deletions liste-envies-front/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
15 changes: 15 additions & 0 deletions liste-envies-front/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Default ignored files
/.idea/shelf/
/.idea/workspace.xml

# Project exclude paths
/documentation/

# Datasource local storage ignored files
/.idea/dataSources/
dataSources.local.xml

# Editor-based HTTP Client requests
/.idea/httpRequests/
rest-client.private.env.json
http-client.private.env.json
Loading

0 comments on commit d867e86

Please sign in to comment.