From 9c7985d35549dd496dea069696b5f05740aa15af Mon Sep 17 00:00:00 2001 From: VEDANT SHROTRIA <40681425+Jonsy13@users.noreply.github.com> Date: Wed, 30 Dec 2020 08:42:57 +0530 Subject: [PATCH] Added Workflows for CI/CD using Github Actions and ( Contributing.md and Readme.md ) Changes (#4) * Added build changes in github actions. Signed-off-by: Vedant Shrotria * Changed CI Config Signed-off-by: Vedant Shrotria * Changed CI Config Signed-off-by: Vedant Shrotria * Added Some CI changes. Signed-off-by: Vedant Shrotria * Added Env and file naming Changes. Signed-off-by: Vedant Shrotria * Minor edit in Readme.md. Signed-off-by: Vedant Shrotria * Added minor change for Building image. Signed-off-by: Vedant Shrotria --- .../workflows/{main.yml => Pull_Request.yml} | 25 +++++++-- .github/workflows/docker_Push.yml | 30 +++++++++++ Dockerfile | 2 +- README.md | 54 ++++++++++--------- 4 files changed, 81 insertions(+), 30 deletions(-) rename .github/workflows/{main.yml => Pull_Request.yml} (67%) create mode 100644 .github/workflows/docker_Push.yml diff --git a/.github/workflows/main.yml b/.github/workflows/Pull_Request.yml similarity index 67% rename from .github/workflows/main.yml rename to .github/workflows/Pull_Request.yml index afc5cc6..974bc1f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/Pull_Request.yml @@ -1,10 +1,14 @@ name: LitmusDocs-CI on: pull_request: - types: [ opened, synchronize, reopened ] + types: [ opened, synchronize, reopened, edited ] + paths: + - '.github/workflows/dockerbuild.yml' + - '.github/workflows/Pull_Request.yml' + - 'website/**' jobs: - embedmd: + embedmdCheck_and_linksVerification: runs-on: ubuntu-latest steps: @@ -17,11 +21,16 @@ jobs: stable: 'false' go-version: '1.14.0' + - name: Links Verification + run: | + go get -u -v github.com/bmuschko/link-verifier + link-verifier --dirs website,README.md --fail=false + - name: Installing and Running embedmed run: | sudo apt install boxes go get github.com/campoy/embedmd - cd docs + cd website/docs embedmd -w $(find *.md) continue-on-error: true @@ -36,7 +45,7 @@ jobs: output=$(git status -s) echo "$output" | boxes -d stone -p a2v1 tput setaf 3; echo "Please follow the instructions to run embedmd:" - tput setaf 3; echo "cd docs" + tput setaf 3; echo "cd website/docs" tput setaf 3; echo "embedmd -w \$(find *.md)" tput setaf 6; echo "For more info visit https://github.com/litmuschaos/litmus-docs/blob/master/CONTRIBUTING.md" exit 1 @@ -44,3 +53,11 @@ jobs: tput setaf 2; echo "Nothing to embed" fi shell: sh + + ci: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Build + run: docker build -t $GITHUB_REPOSITORY . \ No newline at end of file diff --git a/.github/workflows/docker_Push.yml b/.github/workflows/docker_Push.yml new file mode 100644 index 0000000..b8a7ae9 --- /dev/null +++ b/.github/workflows/docker_Push.yml @@ -0,0 +1,30 @@ +name: CD-Build + +on: + push: + branches: + - master + paths: + - '.github/workflows/dockerbuild.yml' + - '.github/workflows/Pull_Request.yml' + - 'website/**' + +jobs: + cd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Declare some variables + id: vars + shell: bash + run: | + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Docker login + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin + - name: Build and Push the Docker Image + run: | + docker build -t ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} . + docker push ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} + + diff --git a/Dockerfile b/Dockerfile index cb09636..e074228 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM node:14.15.0 AS build-env WORKDIR /app/website EXPOSE 3000 35729 -COPY ./website /app/website +COPY . /app/ RUN npm install RUN npm run build CMD ["npm", "start"] diff --git a/README.md b/README.md index f09cf01..56cec52 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ + -Documentation pour le projet Litmus +# Documentation for the Litmus Project [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-docs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-docs?ref=badge_shield) [![Slack Channel](https://img.shields.io/badge/Slack-Join-purple)](https://slack.litmuschaos.io) @@ -9,72 +10,76 @@ Documentation pour le projet Litmus [![GitHub pull requests](https://img.shields.io/github/issues-pr/litmuschaos/litmus-docs?logo=git)](https://github.com/litmuschaos/litmus-docs/pulls) [![Twitter Follow](https://img.shields.io/twitter/follow/litmuschaos?style=social)](https://twitter.com/LitmusChaos) [![YouTube Channel](https://img.shields.io/badge/YouTube-Subscribe-red)](https://www.youtube.com/channel/UCa57PMqmz_j0wnteRa9nCaw) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat&logo=github)](https://github.com/litmuschaos/litmus-docs/pulls) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat&logo=github)](https://github.com/litmuschaos/litmus-docs/pulls) [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/litmuschaos/litmus-docs) ![GitHub top language](https://img.shields.io/github/languages/top/litmuschaos/litmus-docs) +#### _Read this in [other languages](translations/TRANSLATIONS.md)._ -Une description détaillée de projet Docusaurus est disponible - [ici](https://docusaurus.io/docs/en/installation.html). +[FR](translations/README-fr.md) -## Pour les développeurs +Additional details on the Docusaurus project can be found [here](https://docusaurus.io/docs/en/installation.html). -### Cloner le répertoire litmus-docs +# + +## For Developers + +### Clone litmus-docs repository ```bash git clone https://github.com/litmuschaos/litmus-docs.git cd litmus-docs ``` -Le serveur de site web documentaire peut être configuré manuellement ou en utilisant docker compose +The docs website server can be setup manually or through docker compose -## Utiliser les commandes embedmd avant de commiter les changements +## Use embedmd command before commiting changes -Le code incorporé sera extrait du fichier à `URL`, qui peut être un chemin relatif vers un autre dans le fichier de système local( en utilisant les barres obliques comme spérateur de répertoire) ou une URL commençant par `http://` ou `https://.` +The embedded code will be extracted from the file at `URL`, which can either be a relative path to a file in the local file system (using forward slashes as directory separator) or a URL starting with `http://` or `https://.` _Installation:_ -- Il faut bien vérfier que [golang](https://github.com/golang/go) est installé. On a juste besoin d'exécuter la commande ci-dessous pour installer embedmd. +- Make sure you have [golang](https://github.com/golang/go) installed. We just need to run the following command to install embedmd. ```bash go get github.com/campoy/embedmd ``` -_Exécution embedmd (doît être faite avant de commiter les modifications):_ +_Run embedmd (needs to be done before commiting the changes):_ -- Suivez les étapes ci-dessous(à partir de répertoire root) pour exécuter embedmd: +- Follow the steps (from root directory) to run embedmd: ```bash -cd docs +cd website/docs embedmd -w $(find *.md) ``` -_Vérifier la différence:_ -- L'exécution de cette commmande `embedmd -d docs-name.md` révelera la différence entre le contenu de docs-name.md et le résultat de embedmd docs-name.md. +_Check the difference:_ +- Executing `embedmd -d docs-name.md` will display the difference between the contents of docs-name.md and the output of embedmd docs-name.md. -## La configuration manuelle +## Manual Setup -### Installer Node.js +### Install Node.js ```bash sudo apt-get install software-properties-common curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - ``` -### Télécharger la dérniére version Node.js +### Get the latest Node.js package ```bash sudo apt-get install -y nodejs ``` -### Installer Yarn +### Install Yarn ```bash npm install -g yarn ``` -### Démarrer le serveur +### Start the server ```bash cd website @@ -82,26 +87,25 @@ yarn install yarn start ``` -## La configuration via Docker compose +## Using Docker compose -### Installer docker compose +### Install docker compose ```bash sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose ``` -### Démarrer le serveur +### Run the server ```bash docker-compose up ``` +## Browse local documentation -## Parcourir la documentation locale http://localhost:3000/docs/next/getstarted.html - ## License [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-docs.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Flitmuschaos%2Flitmus-docs?ref=badge_large)