-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge FlyFly & EdgeChains * Update BuildAndRun.yml
- Loading branch information
1 parent
8b581b0
commit dd8ff59
Showing
23 changed files
with
1,027 additions
and
126 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,21 +10,21 @@ jobs: | |
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set SHORT_HASH | ||
run: | | ||
echo "::set-output name=VALUE::${LONG_HASH:0:8}" | ||
echo "RELEASE_TAG=${LONG_HASH:0:8}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV | ||
echo "::set-output name=VALUE::${LONG_HASH:0:8}" | ||
echo "RELEASE_TAG=${LONG_HASH:0:8}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV | ||
id: short_hash | ||
env: | ||
LONG_HASH: ${{ github.sha }} | ||
LONG_HASH: ${{ github.sha }} | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Set up Maven | ||
uses: stCarolas/[email protected] | ||
with: | ||
|
@@ -33,34 +33,31 @@ jobs: | |
- name: Create output folder | ||
run: mkdir BuildOutput | ||
|
||
# - name: Build flyfly project | ||
# working-directory: ./FlySpring/flyfly | ||
# run: mvn clean package | ||
|
||
- name: Build flyfly project | ||
working-directory: ./FlySpring/flyfly | ||
run: mvn clean package | ||
|
||
|
||
|
||
- name: Copy flyfly JAR to Examples folder and rename | ||
run: cp ./FlySpring/flyfly/target/flyfly-0.0.1-SNAPSHOT.jar ././BuildOutput/flyfly.jar | ||
# - name: Copy flyfly JAR to Examples folder and rename | ||
# run: cp ./FlySpring/flyfly/target/flyfly-0.0.1-SNAPSHOT.jar ././BuildOutput/flyfly.jar | ||
|
||
- name: Build edgechain-app project | ||
working-directory: ./FlySpring/edgechain-app | ||
# run: mvn -Djavacpp.platform=linux-x86_64 clean package -DskipTests | ||
# run: mvn -Djavacpp.platform=linux-x86_64 clean package -DskipTests | ||
run: mvn clean package -DskipTests | ||
|
||
- name: Run edgechain testcases | ||
working-directory: ./FlySpring/edgechain-app | ||
run: mvn test | ||
|
||
- name: Copy edgechain-app JAR to Examples folder | ||
run: cp ./FlySpring/edgechain-app/target/edgechain-app-1.0.0.jar ./BuildOutput/ | ||
run: cp ./FlySpring/edgechain-app/target/edgechain.jar ./BuildOutput/ | ||
|
||
- name: Upload Examples folder as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Output | ||
path: ./BuildOutput/ | ||
|
||
release: | ||
name: Release jar | ||
needs: build_and_run | ||
|
@@ -75,35 +72,35 @@ jobs: | |
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
# - name: Create Release | ||
# id: create_release | ||
# uses: actions/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ github.ref }} | ||
# release_name: ${{ github.ref }} | ||
# - name: Upload Release jar | ||
# id: upload_release_asset | ||
# uses: actions/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: Examples/ | ||
# asset_name: Examples | ||
# asset_content_type: application/zip | ||
# - name: Create Release | ||
# id: create_release | ||
# uses: actions/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ github.ref }} | ||
# release_name: ${{ github.ref }} | ||
# - name: Upload Release jar | ||
# id: upload_release_asset | ||
# uses: actions/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: Examples/ | ||
# asset_name: Examples | ||
# asset_content_type: application/zip | ||
- name: 'Get variables' | ||
id: vars | ||
run: | | ||
echo "tag_name= ${{needs.build_and_run.outputs.VALUE}}" >> $GITHUB_OUTPUT | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.RELEASE_TAG }} | ||
# body: 🚀 Automated build | ||
files: | | ||
./Output/**/*.* | ||
# tag_name: ${{needs.build_and_run.steps.short_hash.outputs.VALUE}} | ||
tag_name: ${{ env.RELEASE_TAG }} | ||
# body: 🚀 Automated build | ||
files: | | ||
./Output/**/*.* | ||
# tag_name: ${{needs.build_and_run.steps.short_hash.outputs.VALUE}} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ build/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
/src/main/resources/jbang.jar |
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
55 changes: 55 additions & 0 deletions
55
FlySpring/edgechain-app/src/main/java/com/edgechain/EdgeChainApplication.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.edgechain; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.WebApplicationType; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.builder.SpringApplicationBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.servlet.handler.HandlerMappingIntrospector; | ||
|
||
import java.net.URL; | ||
import java.nio.file.Paths; | ||
|
||
@SpringBootApplication | ||
public class EdgeChainApplication { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(EdgeChainApplication.class); | ||
|
||
public static void main(String[] args) { | ||
|
||
System.setProperty("jar.name", getJarFileName(EdgeChainApplication.class)); | ||
|
||
logger.info("Executed jar file: "+System.getProperty("jar.name")); | ||
|
||
SpringApplication springApplication = | ||
new SpringApplicationBuilder() | ||
.sources(EdgeChainApplication.class).web(WebApplicationType.NONE) | ||
.build(); | ||
|
||
springApplication.run(args); | ||
} | ||
|
||
@Bean(name = "mvcHandlerMappingIntrospector") | ||
public HandlerMappingIntrospector mvcHandlerMappingIntrospector() { | ||
return new HandlerMappingIntrospector(); | ||
} | ||
|
||
private static String getJarFileName(Class<?> clazz) { | ||
URL classResource = clazz.getResource(clazz.getSimpleName() + ".class"); | ||
if (classResource == null) { | ||
throw new RuntimeException("class resource is null"); | ||
} | ||
String url = classResource.toString(); | ||
if (url.startsWith("jar:file:")) { | ||
String path = url.replaceAll("^jar:(file:.*[.]jar)!/.*", "$1"); | ||
try { | ||
return Paths.get(new URL(path).toURI()).toString(); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Invalid jar file"); | ||
} | ||
} | ||
throw new RuntimeException("Invalid jar file"); | ||
} | ||
} |
Oops, something went wrong.