fix: ci
Some checks failed
ci / build (push) Failing after 5s

This commit is contained in:
han0
2025-10-13 17:36:03 +08:00
parent 179a14f26b
commit 5d2770f4de
8 changed files with 480 additions and 13 deletions

41
.gitea/.m2/settings.xml Normal file
View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>.m2/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<mirrors>
<mirror>
<id>maven-public</id>
<mirrorOf>*</mirrorOf>
<name>maven-public</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>8</jdk>
</activation>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jdk-8</activeProfile>
</activeProfiles>
</settings>

51
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,51 @@
name: ci
on:
push:
branches:
- test
env:
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=${{ github.workspace }}/.m2/repository
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
MAVEN_CLI_OPTS: >-
--batch-mode --errors --fail-at-end --show-version
--settings ${{ github.workspace }}/.gitea/.m2/settings.xml
-DinstallAtEnd=true -DdeployAtEnd=true
DEPLOY_PATH: /home/opt/app/material-manage-service
DEPLOY_TEST_HOST_IP: 172.17.0.1
jobs:
build:
runs-on: ubuntu-latest
container:
image: python:3.7.16
steps:
- name: Checkout
run: |
git clone --depth 1 "http://test:89085111dd6939710a992d6404bd61a50e420685@8.138.239.222:20300/${GITHUB_REPOSITORY}.git" .
git checkout "${GITHUB_SHA}"
- name: Build
run: |
mvn $MAVEN_CLI_OPTS clean compile package -Dmaven.test.skip=true $MAVEN_OPTS
- name: Deploy
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh -o StrictHostKeyChecking=no root@$DEPLOY_TEST_HOST_IP "mkdir -p $DEPLOY_PATH"
ssh root@$DEPLOY_TEST_HOST_IP "rm -f $DEPLOY_PATH/*.jar"
scp target/material-manage-service-*-SNAPSHOT.jar root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/
ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/material-manage-service-*-SNAPSHOT.jar $DEPLOY_PATH/app.jar"
scp docker-compose.test.yml root@$DEPLOY_TEST_HOST_IP:$DEPLOY_PATH/
ssh root@$DEPLOY_TEST_HOST_IP "mv $DEPLOY_PATH/docker-compose.test.yml $DEPLOY_PATH/docker-compose.yml"
ssh root@$DEPLOY_TEST_HOST_IP "cd $DEPLOY_PATH && docker compose up -d --force-recreate"