chore(cd): downgrade Java 21 -> 17 version, because `spring-boot-grad… #7
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: CI | |
on: [ push ] | |
# [ ] Проверить зависимости при помощи OWASP Dependency Check | |
# 4. Собрать docker образ | |
# 5. Подключиться по SSH до dev.muse.kiryuxa.com | |
# 6. Поднять докер контейнер на порту + поменять реверс проксю чтобы перекидывало с dev.muse.kiryuxa.com -> localhost:59195 | |
# Готово! | |
jobs: | |
linter: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up JDK 17 (Temurin) | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17.0' | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Run linter | |
run: ./tools/scripts/runLinter.sh | |
static-analyzer: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up JDK 17 (Temurin) | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17.0' | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Run static analyzer | |
run: ./tools/scripts/runStaticAnalyzer.sh | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Set up JDK 17 (Temurin) | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17.0' | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Run Unit Tests | |
run: ./tools/scripts/runUnitTests.sh | |
- name: Publish Unit Test Results | |
if: always() | |
uses: EnricoMi/[email protected] | |
with: | |
files: ./**/**/build/test-results/**/*.xml | |
report_individual_runs: true | |
- name: Gather reports | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: reports | |
path: ./**/**/build/reports | |
deploy: | |
runs-on: ubuntu-22.04 | |
needs: [ "linter", "static-analyzer", "unit-tests" ] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub via token | |
run: sudo docker login -u myshx -p ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build Server Docker Image | |
run: | | |
./tools/scripts/buildJar.sh | |
sudo docker build . -t myshx/muse-server:${{ github.sha }} | |
- name: Push Server Docker Image | |
run: sudo docker push myshx/muse-server:${{ github.sha }} | |
- name: Run Server docker image at home lab | |
uses: appleboy/[email protected] | |
env: | |
COMMIT_SHA: ${{ github.sha }} | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
envs: COMMIT_SHA | |
script: | | |
sudo docker stop $(sudo docker ps --filter ancestor=muse-server -q) | |
sudo docker rm $(sudo docker ps --filter ancestor=muse-server -q) | |
sudo docker rmi $(sudo docker ps --filter ancestor=muse-server -q) | |
sudo docker run "myshx/muse-server:COMMIT_SHA" -p 50505:80 |