Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Technical Feature/NR-61 Semantic versioning #191

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 73 additions & 4 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate backend.
name: Validate, build, tag, push and deploy backend.

on:
push:
Expand All @@ -7,27 +7,96 @@ on:
pull_request:
branches: [master]
paths: ["backend/**"]
types:
- opened
- synchronize

jobs:
tests:
validate:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.12.1]
node-version: [18.18.2]

steps:
- uses: actions/checkout@v3
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install backend dependencies
run: npm ci -w backend

- name: Prettier check
run: npm run -w backend prettier:check

- name: Unit tests
run: npm run -w backend unit-test

- name: Integration tests
run: npm run -w backend integration-test

- name: Check if a valid semver git tag is present
run: |
GIT_TAG=$(git describe --tags --exact-match)
# https://github.com/semver/semver/issues/981
SEMVER_REGEX="^(backend|frontend)\/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$"
if [[ -z "$GIT_TAG" ]]; then
echo "ERROR: no tag found"
exit 1
elif ! [[ $GIT_TAG =~ $SEMVER_REGEX ]]; then
echo "ERROR: $GIT_TAG is not a Semver tag with expected prefix"
exit 1
else
echo "Tag found: $GIT_TAG"
fi

build-and-push:
needs: validate
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: sjakusch/steam-game-stats-backend
tags: |
type=match,pattern=backend\/v(\d+.\d+.\d+),group=1

- name: Build and push
uses: docker/build-push-action@v4
with:
# push only if master is updated
push: ${{ github.ref == 'refs/heads/master' }}
file: backend/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Deploy on Render
# deploy only if master is updated
if: github.ref == 'refs/heads/master'
env:
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: |
curl "$deploy_url"
59 changes: 0 additions & 59 deletions .github/workflows/cicd-backend.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build frontend.

on:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build
todo.md
.mongodb
.secrets
local

npm-debug.log*
yarn-debug.log*
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Steam Game Stats

## Project details
## Table of Contents

1. [Project Details](#project-details)
1. [Development Setup](#development-setup)
1. [Running the Application](#running-the-application)
1. [Debugging](#debugging)
1. [Project Workflow](docs/project-workflow.md)

## Project Details

The Steam Game Stats application collects current steam platform player numbers through the steam api. The historic player numbers are collected by crawling through various online sources. This data is stored in our database, facilitating custom game statistics queries. This allows us to highlight key metrics, such as trending games, personalized game recommendations based on user preferences, most popular games, and other useful insights. Please note that some of these features are still in development.

Expand Down Expand Up @@ -126,7 +134,3 @@ The debugging configuration is only available for VSCode. You can debug the back
For debugging the application in the Docker container select the configuration starting with "`Docker: ...`". This configuration will rebuild the backend image, start the Docker Compose setup with Node.js in debug mode and attach itself to it so that you can set breakpoints in VSCode. When you are finished debugging detach the debugger and the configuration will stop and clean up the containers.

The Docker debugging configuration uses the `local-db.env` file for the db setup. For more info on the debugging configuration check the `launch` and `tasks` sections in `.vscode/steam-game-stats.code-workspace`.

## Creating Issues

If you would like to create an issue with a template, simply click "Get started" when creating an issue. If you would like to create an issue without a template, click on "Open a blank issue"
39 changes: 2 additions & 37 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
# Project and Course Description
# Steam Game Stats Backend

## Table of Contents

1. [Introduction](#introduction)
1. [Course Content](#course-content)
1. [Project Details](#project-details)
1. [Architecture](#architecture)

## Introduction

This repository contains the backend implementation of a proof of concept application which was developed by Luka Tarman during an intensive full stack web developer course. The purpose of this repository is to demonstrate the skillset of Luka Tarman to potential employers.

A few words about the student. Luka Tarman is an adaptable and open minded Full Stack Software Developer with a preference for the backend layer. He started with software development due to his extensive experience with computers from a young age, and the fact that he finds great joy in solving technical problems. An up to date CV of Luka can be found here: [CV](https://docs.google.com/document/d/1koF3BsafLKzIdoWY6iUA0Oq-BxEqdRP4ZrKAQ16nwnA/edit?usp=sharing).

A few words about the course instructor. The instructor is [Stanislav Jakuschevskij](https://www.linkedin.com/in/stanislav-jakuschevskij/). He is a Senior Software Engineer at IBM with a specialization in Blockchain. You can find out more about him on LinkedIn. In case a potential employer for Luka would like to ask questions about the course and Lukas programming education he or she can contact Stanislav via LinkedIn.

At the time of this writing the application is in a running state and can be demonstrated. If you want to test the application read the main [README.md](../README.md) below. The development continues and new features are constantly introduced.

## Course Content

The course content is documented separately. Follow this [link](/docs/course.content.md) for more info.

## Project Details

The _Steam Game Stats_ application collects current and historic player numbers of all games available on the steam platform through the steam api and other online sources. The idea behind it is at some point to identify trending "niche" games which are gaining in popularity before they hit the mainstream channels. In its current iteration there is not yet a distinction between niche and mainstream games. But this feature will be added in the future.

The backend is designed to run 24/7 and collect player numbers of games every day. It provides a REST API for the frontend.

The frontend shows a list of top trending games with a search functionality for games and a detail view with all collected player numbers in a table.

## Architecture

The application uses a 3-tier architecture.

Container diagram pending: [#91](https://github.com/lukatarman/steam-game-stats-backend/issues/91).

Data model diagram pending: [#91](https://github.com/lukatarman/steam-game-stats-backend/issues/91).
tba
121 changes: 0 additions & 121 deletions backend/docs/course.content.details.md

This file was deleted.

Loading
Loading