Added devcontainer and updated pipeline.
All checks were successful
ydeng/islandsurvivalcraft/pipeline/head This commit looks good

This commit is contained in:
Harrison Deng 2024-07-22 04:54:33 +00:00
parent 4487a2cb16
commit 6a37c9c90b
9 changed files with 35 additions and 89 deletions

View File

@ -1,11 +0,0 @@
FROM mcr.microsoft.com/devcontainers/anaconda:1-3
# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@ -1,31 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/anaconda // README at: https://github.com/devcontainers/templates/tree/main/src/java
{ {
"name": "Anaconda (Python 3)", "name": "Java",
"build": { // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"context": "..", "image": "mcr.microsoft.com/devcontainers/java:1-11-bullseye",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"vscjava.vscode-java-test",
"vscjava.vscode-java-dependency",
"vscjava.vscode-maven",
"redhat.java",
"vscjava.vscode-java-debug"
]
}
}
// Features to add to the dev container. More info: https://containers.dev/features. "features": {
// "features": {}, "ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "true"
},
"ghcr.io/devcontainers/features/powershell:1": {}
}
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [], // "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "python --version", // "postCreateCommand": "java -version",
// Configure tool-specific properties. // Configure tool-specific properties.
// "customizations": {}, // "customizations": {},

View File

@ -1,3 +0,0 @@
This file copied into the container along with environment.yml* from the parent
folder. This file is included to prevents the Dockerfile COPY instruction from
failing if no environment.yml is found.

8
.vscode/launch.json vendored
View File

@ -4,6 +4,12 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{
"type": "java",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickJavaProcess}"
},
{ {
"type": "java", "type": "java",
"name": "Debug (Launch) - Current File", "name": "Debug (Launch) - Current File",
@ -19,8 +25,6 @@
"sourcePaths": [ "sourcePaths": [
"src/main/java" "src/main/java"
], ],
"preLaunchTask": "start test server",
"postDebugTask": "stop test server"
} }
] ]
} }

21
Jenkinsfile vendored
View File

@ -1,27 +1,32 @@
pipeline { pipeline {
agent any agent {
kubernetes {
cloud 'Reslate Systems'
defaultContainer 'conda'
}
}
stages { stages {
stage ("Install") { stage ("Install") {
steps { steps {
sh 'mamba env update --file environment.yml' sh 'conda update conda -y -q'
sh 'echo "mamba activate islandsurvivalcraft" >> ~/.bashrc' sh 'conda env update -n base --file environment.yml -q'
sh "mvn validate" sh "conda run -n base mvn validate"
} }
} }
stage ("Build") { stage ("Build") {
steps { steps {
sh "mvn compile" sh "conda run -n base mvn compile"
} }
} }
stage ("Test") { stage ("Test") {
steps { steps {
sh "mvn -Dmaven.test.skip=false test" sh "conda run -n base mvn -Dmaven.test.skip=false test"
junit 'target/surefire-reports/TEST-*.xml' recordCoverage(tools: [[parser: 'JUNIT', pattern: 'target/surefire-reports/TEST-*.xml']])
} }
} }
stage ("Package") { stage ("Package") {
steps { steps {
sh "mvn package" sh "conda run -n base mvn package"
archiveArtifacts artifacts: 'target/*.jar', fingerprint: true, followSymlinks: false archiveArtifacts artifacts: 'target/*.jar', fingerprint: true, followSymlinks: false
} }
} }

View File

@ -2,5 +2,5 @@ name: islandsurvivalcraft
channels: channels:
- conda-forge - conda-forge
dependencies: dependencies:
- openjdk=11.0.* - openjdk=21
- maven=3.8.* - maven

View File

@ -1,21 +0,0 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"java.configuration.updateBuildConfiguration": "automatic",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"cSpell.words": [
"Bukkit",
"crafter",
"itemstack"
]
}
}

View File

@ -1,21 +0,0 @@
package ca.recrown.islandsurvivalcraft;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Hello world!
*
*/
public class IslandSurvivalCraftPlugin extends JavaPlugin {
@Override
public void onEnable() {
// TODO Auto-generated method stub
super.onEnable();
}
@Override
public void onDisable() {
// TODO Auto-generated method stub
super.onDisable();
}
}

View File

@ -1 +1 @@
Start-Process java -ArgumentList "-Xms512M", "-Xmx1G", "-jar", "craftbukkit.jar", "nogui" Start-Process java -ArgumentList "-Xms512M", "-Xmx1G", "-jar", "paper.jar", "nogui"