Skip to content

Commit

Permalink
ci: run tarpaulin by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Oct 11, 2023
1 parent fc63bc2 commit 110f2c0
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 45 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: ci

on: pull_request
on:
pull_request:
push:
branches:
- main

env:
TARGET_NODE_VERSION: '20'
Expand Down Expand Up @@ -99,7 +103,7 @@ jobs:
workspaces: . -> dist/rust

- name: Install Rust dependencies
run: cargo check
run: cargo install cargo-tarpaulin && cargo check

- name: Run tests
uses: mansagroup/nrwl-nx-action@v3
Expand All @@ -108,11 +112,6 @@ jobs:
# parallel: 3
parallel: 1

- name: Create coverage report with Tarpaulin
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out xml --output-dir coverage/rust --workspace
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
Expand Down Expand Up @@ -169,6 +168,8 @@ jobs:
semantic:
runs-on: ubuntu-latest

if: github.event_name == 'pull_request'

steps:
- name: Ensure semantic
uses: amannn/action-semantic-pull-request@v5
Expand Down
30 changes: 16 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
idea
java
`java-library`
jacoco
`maven-publish`
signing
id("idea")
id("java")
id("java-library")
id("jacoco")
id("maven-publish")
id("signing")
kotlin("jvm") version "1.9.0"
kotlin("kapt") version "1.9.0"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("com.github.johnrengelman.shadow") version "8.1.0"
}

allprojects {
group = "io.shulkermc"

repositories {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://repo.papermc.io/repository/maven-public/")
}
repositories {
mavenCentral()
}

subprojects {
Expand All @@ -37,9 +31,17 @@ subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "com.github.johnrengelman.shadow")

group = "io.shulkermc"

project.layout.buildDirectory.set(File("$rootDir/dist/java${project.path.replace(":", "/")}"))
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

repositories {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://repo.papermc.io/repository/maven-public/")
}

dependencies {
testImplementation(kotlin("test"))
}
Expand Down
4 changes: 2 additions & 2 deletions docs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/build"],
"options": {
"command": "npm run build",
"cwd": "docs"
}
},
"outputs": ["{workspaceRoot}/build"]
},
"serve": {
"executor": "nx:run-commands",
Expand Down
1 change: 1 addition & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"{workspaceRoot}/Cargo.lock",
"{workspaceRoot}/.cargo/"
],
"rust:test:dependencies": ["{workspaceRoot}/.tarpaulin.toml"],
"java:dependencies": [
"{workspaceRoot}/build.gradle.kts",
"{workspaceRoot}/gradle.properties",
Expand Down
5 changes: 3 additions & 2 deletions packages/google-agones-crds/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"test": {
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"command": "cargo tarpaulin",
"cwd": "packages/google-agones-crds"
},
"inputs": ["default", "rust:dependencies"]
"inputs": ["default", "rust:dependencies", "rust:test:dependencies"],
"outputs": ["{workspaceRoot}/coverage/rust/google-agones-sdk"]
},
"lint": {
"executor": "nx:run-commands",
Expand Down
6 changes: 6 additions & 0 deletions packages/google-agones-crds/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
skip-clean = true

[report]
out = ["Xml"]
output-dir = "../../coverage/rust/google-agones-crds"
6 changes: 4 additions & 2 deletions packages/google-agones-sdk/bindings/java/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/packages/google-agones-sdk/bindings/java"],
"options": {
"command": "./gradlew :packages:google-agones-sdk-bindings-java:build -x check"
},
"inputs": ["default", "java:dependencies"]
"inputs": ["default", "java:dependencies"],
"outputs": [
"{workspaceRoot}/dist/packages/google-agones-sdk/bindings/java"
]
},
"test": {
"executor": "nx:run-commands",
Expand Down
2 changes: 1 addition & 1 deletion packages/google-agones-sdk/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cwd": "packages/google-agones-sdk"
},
"inputs": ["default"],
"outputs": ["{projectRoot}/bindings/java/src/generated/"]
"outputs": ["{projectRoot}/bindings/java/src/generated"]
}
},
"tags": []
Expand Down
5 changes: 3 additions & 2 deletions packages/shulker-crds/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"test": {
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"command": "cargo tarpaulin",
"cwd": "packages/shulker-crds"
},
"inputs": ["default", "rust:dependencies"]
"inputs": ["default", "rust:dependencies", "rust:test:dependencies"],
"outputs": ["{workspaceRoot}/coverage/rust/shulker-crds"]
},
"lint": {
"executor": "nx:run-commands",
Expand Down
6 changes: 6 additions & 0 deletions packages/shulker-crds/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
skip-clean = true

[report]
out = ["Xml"]
output-dir = "../../coverage/rust/shulker-crds"
12 changes: 9 additions & 3 deletions packages/shulker-operator/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"test": {
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"command": "cargo tarpaulin",
"cwd": "packages/shulker-operator"
},
"inputs": ["default", "rust:dependencies"]
"inputs": ["default", "rust:dependencies", "rust:test:dependencies"],
"outputs": ["{workspaceRoot}/coverage/rust/shulker-operator"]
},
"lint": {
"executor": "nx:run-commands",
Expand All @@ -29,6 +30,11 @@
"inputs": ["default", "rust:dependencies"]
}
},
"implicitDependencies": ["shulker-crds", "shulker-utils", "google-agones-crds", "shulker-sdk-bindings-rust"],
"implicitDependencies": [
"shulker-crds",
"shulker-utils",
"google-agones-crds",
"shulker-sdk-bindings-rust"
],
"tags": ["lang:rust"]
}
6 changes: 6 additions & 0 deletions packages/shulker-operator/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
skip-clean = true

[report]
out = ["Xml"]
output-dir = "../../coverage/rust/shulker-operator"
4 changes: 2 additions & 2 deletions packages/shulker-proxy-agent/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/packages/shulker-proxy-agent"],
"options": {
"command": "./gradlew :packages:shulker-proxy-agent:build -x check"
},
"inputs": ["default", "java:dependencies"]
"inputs": ["default", "java:dependencies"],
"outputs": ["{workspaceRoot}/dist/packages/shulker-proxy-agent"]
},
"test": {
"executor": "nx:run-commands",
Expand Down
4 changes: 2 additions & 2 deletions packages/shulker-sdk/bindings/java/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/packages/shulker-sdk/bindings/java"],
"options": {
"command": "./gradlew :packages:shulker-sdk-bindings-java:build -x check"
},
"inputs": ["default", "java:dependencies"]
"inputs": ["default", "java:dependencies"],
"outputs": ["{workspaceRoot}/dist/packages/shulker-sdk/bindings/java"]
},
"test": {
"executor": "nx:run-commands",
Expand Down
5 changes: 3 additions & 2 deletions packages/shulker-sdk/bindings/rust/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"test": {
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"command": "cargo tarpaulin",
"cwd": "packages/shulker-sdk/bindings/rust"
},
"inputs": ["default", "rust:dependencies"]
"inputs": ["default", "rust:dependencies", "rust:test:dependencies"],
"outputs": ["{workspaceRoot}/coverage/rust/shulker-sdk-bindings/rust"]
},
"lint": {
"executor": "nx:run-commands",
Expand Down
6 changes: 6 additions & 0 deletions packages/shulker-sdk/bindings/rust/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
skip-clean = true

[report]
out = ["Xml"]
output-dir = "../../coverage/rust/shulker-sdk-bindings-rust"
4 changes: 2 additions & 2 deletions packages/shulker-sdk/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"inputs": ["default"],
"outputs": [
"{projectRoot}/bindings/java/src/generated/",
"{projectRoot}/bindings/rust/src/gen/"
"{projectRoot}/bindings/java/src/generated",
"{projectRoot}/bindings/rust/src/gen"
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/shulker-server-api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/packages/shulker-server-api"],
"options": {
"command": "./gradlew :packages:shulker-server-api:build -x check"
},
"inputs": ["default", "java:dependencies"]
"inputs": ["default", "java:dependencies"],
"outputs": ["{workspaceRoot}/dist/packages/shulker-server-api"]
},
"test": {
"executor": "nx:run-commands",
Expand Down
5 changes: 3 additions & 2 deletions packages/shulker-utils/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"test": {
"executor": "nx:run-commands",
"options": {
"command": "cargo test",
"command": "cargo tarpaulin",
"cwd": "packages/shulker-utils"
},
"inputs": ["default", "rust:dependencies"]
"inputs": ["default", "rust:dependencies", "rust:test:dependencies"],
"outputs": ["{workspaceRoot}/coverage/rust/shulker-utils"]
},
"lint": {
"executor": "nx:run-commands",
Expand Down
6 changes: 6 additions & 0 deletions packages/shulker-utils/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
skip-clean = true

[report]
out = ["Xml"]
output-dir = "../../coverage/rust/shulker-utils"

0 comments on commit 110f2c0

Please sign in to comment.