Skip to content

Commit

Permalink
Define code style for spark and java and add code format check to CI (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
acezen authored Sep 6, 2023
1 parent eb0f3d9 commit d095ee6
Show file tree
Hide file tree
Showing 71 changed files with 6,119 additions and 4,031 deletions.
72 changes: 72 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "GraphAr",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "registry.cn-hongkong.aliyuncs.com/graphscope/graphar-dev:latest",
// "image": "ubuntu:22.04",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/common-utils:2":{
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"installOhMyZsh": true,
"upgradePackages": "false"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"github.copilot",
"github.copilot-labs"
]
}
},

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "graphar",

// Use 'postCreateCommand' to run commands before the container is created.
"initializeCommand": "sudo docker pull registry.cn-hongkong.aliyuncs.com/graphscope/graphar-dev:latest",

// Uncomment this to enable C++ and Rust debugging in containers
// "capAdd": ["SYS_PTRACE"],
// "securityOpt": ["seccomp=unconfined"],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000],

// Use 'portsAttributes' to set default properties for specific forwarded ports.
// More info: https://containers.dev/implementors/json_reference/#port-attributes
// "portsAttributes": {
// "9000": {
// "label": "Hello Remote World",
// "onAutoForward": "notify"
// }
// },

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install"

// Improve performance

// Uncomment these to mount a folder to a volume
// https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume
// "mounts": [
// "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
// ],


// Uncomment these to use a named volume for your entire source tree
// https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-named-volume-for-your-entire-source-tree
// "workspaceMount": "source=gs,target=/workspaces,type=volume",
// "workspaceFolder": "/workspaces"
"postCreateCommand": "sudo chown -R graphar /workspaces && bash pre-commit/install-hook.sh && bash pre-commit/prepare-commit-msg"
}
22 changes: 7 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,15 @@ on:
push:
branches:
- main
paths-ignore:
- 'LICENSE'
- '**.md'
- '**.rst'
- 'docs/**'
- 'misc/**'
- 'spark/**'
paths:
- 'cpp/**'
- '.github/workflows/ci.yml'
pull_request:
branches:
- main
paths-ignore:
- 'LICENSE'
- '**.md'
- '**.rst'
- 'docs/**'
- 'misc/**'
- 'spark/**'
paths:
- 'cpp/**'
- '.github/workflows/ci.yml'

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
Expand Down Expand Up @@ -115,7 +107,7 @@ jobs:
export GAR_TEST_DATA=$PWD/../testing/
make test
GraphAr-centos8-arrow-installed:
GraphAr-centos-arrow-installed:
runs-on: ubuntu-latest
container:
image: centos:7
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ jobs:
sudo apt-get install libcurl4-openssl-dev -y
sudo apt-get install llvm-11 clang-11 lld-11 libclang-11-dev libz-dev -y
- name: Code Format Check
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd java
mvn spotless:check
popd
- name: Build and Install cpp
run: |
mkdir build
Expand All @@ -55,5 +62,5 @@ jobs:
export JAVA_HOME=${JAVA_HOME_11_X64}
export LLVM11_HOME=/usr/lib/llvm-11
pushd java
mvn test
mvn test -Dspotless.check.skip=true
popd
13 changes: 11 additions & 2 deletions .github/workflows/spark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
- main
paths:
- 'spark/**'
- '.github/workflows/spark.yaml'
pull_request:
branches:
- main
paths:
- 'spark/**'
- '.github/workflows/spark.yaml'

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
Expand All @@ -26,18 +28,25 @@ jobs:
with:
submodules: true

- name: Code Format Check
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd spark
mvn spotless:check
popd
- name: Build GraphAr Spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd spark
mvn clean package -DskipTests
mvn clean package -DskipTests -Dspotless.check.skip=true
popd
- name: Run test
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd spark
mvn test
mvn test -Dspotless.check.skip=true
popd
- name: Run Neo4j2GraphAr example
Expand Down
13 changes: 13 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@
<argLine>-Djava.library.path=${project.basedir}/target/native</argLine>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.20.0</version>
<configuration>
<java>
<googleJavaFormat>
<version>1.13.0</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down
Loading

0 comments on commit d095ee6

Please sign in to comment.