Skip to content

Zenika/skillZ

Repository files navigation

SkillZ

SkillZ is an application for managing the skills and competences of Zenika's different collaborators. It aims at gathering the feedbacks in order to match the different profiles with missions or trainings that correspond the best. Actually there is 3 diferents applications all functional, and linked to each other :

In this repository, you can access to Skillz web app and Skillz Slack bot scripts.

If you have any questions about the diferents projects, don't hesitate to open issues on this repository, or ask your questions on the channel #project-skillz in the Zenika's Slack.

Table of contents

  1. Skillz web app
    1. Requirements
    2. Quick Start
      1. Docker
      2. Install dependencies
      3. Create an .env file
      4. Run postgres and hasura locally with docker
      5. Run the hasura migrations
      6. Develop with hasura
      7. Launch the app
      8. Generate local seeds
    3. Tests
      1. E2E with Cypress
      2. Management rules
  2. Skillz Slack bot
    1. Documentation
    2. Development
      1. Configuration
      2. Versionning
  3. Github
    1. Actions
      1. Update referentials
    2. Dependabot

Skillz web app

A progressive web app to store your proficiency and desire to learn different skills.

Requirements

  • Node 16.13.1
  • Npm 8.1.2
  • Docker

Quick start

Docker

You will need Docker installed on your machine.

Install dependencies

Install dependencies using npm install at the root of the project.

Create an .env file

Create an file named .env, then add these variables :

# If you're using Linux, your local (or distant) hasura endpoint url should looks like this :
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:8080/v1/graphql
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_API_BEARER_TOKEN=Bearer key

## HASURA
SKILLZ_GRAPHQL_JWT_SECRET={"type": "RS512", "key": "{your-certificate}"}
HASURA_ACHIEVEMENTS_ENDPOINT=http://172.17.0.1:3000/api/achievement
HASURA_ADMIN_SECRET=key

## AUTH0
NEXT_PUBLIC_AUTH0_CONNECTION=google-oauth2
NEXT_PUBLIC_AUTH0_DOMAIN=
NEXT_PUBLIC_AUTH0_CLIENT_ID=
NEXT_PUBLIC_AUTH0_AUDIENCE=
NEXT_PUBLIC_AUTH0_CALLBACK=/auth

Run postgres and hasura locally with docker

Start by running docker compose up -d to launch the postgres database and the hasura graphql-engine.

Check that engine is running by going to http://localhost:8080 (do not modify schemas through this URL).

Run the hasura migrations

In order to initialize / update the database run :

# npm run hasura migrate apply # Sets up the schema
# npm run hasura metadata apply # Sets up GraphQL
# npm run hasura seed apply # Optional : seeds/cleans up the database with referential data

Connect to the Hasura console by running npm run hasura console (it should open the console in your browser with the correct port (to keep track of schema changes in the hasura/migrations folder)).

Develop with hasura

For hasura to generate the migration files properly the hasura console must be run apart from the "in-app" hasura engine and console.

# npm install --global hasura-cli # Installs the hasura console globally
# cd ./hasura # Go into the hasura folder to reuse the config.yaml
# hasura console # Runs the "other" hasura console on a different port

Launch the app

Run the dev server using npm run dev. The application should be available at the URL specified in your .env file under NEXT_PUBLIC_BASE_URL.

Generate local seeds

If you want to generate random seed data, you can use the hasura console to export the Skill table to JSON Then move it to hasura/local_seeds/Skill.json You can now run npm run seeds:generate And npm run seeds:apply to apply the random data to the database

Tests

E2E with Cypress

Create a file named .env.test, with the same content as the .env. Replace the value of the variable NEXT_PUBLIC_AUTH0_CONNECTION with Username-Password-Authentication

Create a file named cypress.env.json at the root of the project with the following content :

{
  "test_username": "",
  "test_password": ""
}

In order to run all tests :

# start the webapp
npm run build:e2e
npm run start:e2e
## or
NODE_ENV=test npm run dev

# start cypress tests
npm run cypress:run
## or with ui
npm run cypress:open

Before running cypress tests, all data from the test user should be deleted.

Management rules

See all rules in doc/rg.md. You can find the part of the code corresponding to each rule in the comments of the code.

Skillz Slack bot

Slack bot for Skillz App - Keep updated about the new releases of the app, and your activity. The bot's scripts are placed in the folder ./bot-slack/.

This bot in only available in the Slack Zenika workspace.

Install bot

The usage of the bot is only available on the Zenika's Slack. So, click on your channels settings in side bar, the on " Apps" such as the screenshot below :

1

Then, search "Skillz-bot" on the search bar. It will purpose you the bot. Just click on it to install it to your workspace.

2

It's done ! You can now use the bot. Go on the bot's section "About" to know how use the commands.

Documentation

All the informations about this bot (configuration, etc) are in this file.

Architecture schéma is in this file.

Development

Configuration

1/ Start by running : npm i 2/ Create an file named .env, then find variables thanks to the documentation : https://docs.google.com/document/d/1VNHepiCHvmf6mLz2AZmaUNJzSKHFuQS4N2nUNNzKepY/edit# 3/ Launch the app : npm run dev

Testing

🚧 Tests are in progress. 🚧

The test library used is Jest. You can use tests with this command : npm run test.

The coverage library is installed on this project. You can check the coverage of this project with this command : npm run coverage.

Versioning

Check the actual version of the bots thanks to /skillz-version-{ENV}. If you want to update it, change the "version" field from the package.json

Github

Actions

Update referentials

This Github Actions is located in .github/workflows/update-referentials.yml

  • Run every monday à 6:00am UTC
  • Get all approved data from skills.zenika.com
  • Update files located in hasura/seeds with new approved data
  • Create a merge request

Dependabot

Dependabot helps us keep our dependencies up to date. It checks our dependency files for outdated requirements and opens individual PRs.

The configuration file is located in .github/dependabot.yml

  • Run every first day of the month
  • Create PR for skills-app and skills-bot