[issue-19] Heatmap of active week day and hours #19 #163
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PocketStats CI | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
environment: master | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Java | |
uses: actions/setup-java@v3.9.0 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: true | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Build backend and analyse | |
uses: gradle/gradle-build-action@v2.4.0 | |
with: | |
gradle-version: current | |
arguments: build jacocoTestReport sonar --info -Dsonar.organization=michmzr -Dsonar.projectKey=michmzr_PocketStats -Dsonar.host.url=https://sonarcloud.io -Dsonar.verbose=true | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
build: | |
needs: | |
- tests | |
runs-on: ubuntu-latest | |
environment: master | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Java | |
uses: actions/setup-java@v3.9.0 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
check-latest: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Build backend | |
uses: gradle/gradle-build-action@v2.4.0 | |
with: | |
gradle-version: current | |
arguments: build -x test | |
- name: Upload backend JAR artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app.jar | |
path: ./build/libs/app.jar | |
- name: Install SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan 38.242.142.123 >> ~/.ssh/known_hosts | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy app.jar to server | |
run: | | |
scp ./build/libs/app.jar pocketstats@38.242.142.123:/usr/lib/pocketstats/app.jar | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Run commands on server | |
run: | | |
ssh pocketstats@38.242.142.123 'sudo systemctl stop pocketstats.service' | |
ssh pocketstats@38.242.142.123 'sudo systemctl daemon-reload' | |
ssh pocketstats@38.242.142.123 'sudo systemctl start pocketstats.service' | |
ssh pocketstats@38.242.142.123 'systemctl status pocketstats.service' | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Health check | |
run: | | |
echo "Waiting for 30 seconds before healthcheck" | |
sleep 30 | |
echo "Performing healthcheck" | |
wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 10 http://38.242.142.123:8080/pocketstats/actuator/health -O /dev/null | |
shell: bash |