Make ci clearer as to what version is being tested (#861)

* Make ci clearer as to what version is being tested

* Update ci.yml

* fix

* fix
This commit is contained in:
u9g 2021-06-12 22:54:16 -04:00 committed by GitHub
parent 1796b9693d
commit 3813d4de7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 64 deletions

View file

@ -2,50 +2,43 @@ name: CI
on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
mcVersionIndex: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
mcVersion: ['1.7', '1.8', '1.9', '1.10', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '21w07a']
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: 14.x
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 1.8
java-package: jre
- run: npm install
- env:
CIRCLE_NODE_INDEX: ${{ matrix.mcVersionIndex }}
CIRCLE_NODE_TOTAL: 11
run: npm test
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test -- -g ${{ matrix.mcVersion }}
packet-cycle-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: 14.x
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:

View file

@ -12,12 +12,7 @@ const testDataWrite = [
// TODO: add more packets for better quality data
]
const { firstVersion, lastVersion } = require('./common/parallel')
console.log({ firstVersion, lastVersion })
mc.supportedVersions.forEach(function (supportedVersion, i) {
if (!(i >= firstVersion && i <= lastVersion)) { return }
for (const supportedVersion of mc.supportedVersions) {
const mcData = require('minecraft-data')(supportedVersion)
const version = mcData.version
describe('benchmark ' + version.minecraftVersion, function () {
@ -49,4 +44,4 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
done()
})
})
})
}

View file

@ -9,13 +9,9 @@ const MC_SERVER_PATH = path.join(__dirname, 'server')
const Wrap = require('minecraft-wrap').Wrap
const { firstVersion, lastVersion } = require('./common/parallel')
const download = require('minecraft-wrap').download
mc.supportedVersions.forEach(function (supportedVersion, i) {
if (!(i >= firstVersion && i <= lastVersion)) { return }
for (const supportedVersion of mc.supportedVersions) {
const PORT = Math.round(30000 + Math.random() * 20000)
const mcData = require('minecraft-data')(supportedVersion)
const version = mcData.version
@ -257,4 +253,4 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
})
})
})
})
}

View file

@ -1,20 +0,0 @@
const nodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX)
const nodeTotal = parseInt(process.env.CIRCLE_NODE_TOTAL)
const parallel = process.env.CIRCLE_NODE_INDEX !== undefined && process.env.CIRCLE_NODE_TOTAL !== undefined
const mc = require('../../')
// expected values :
// (0,4,10) -> (0,2)
// (1,4,10) -> (3,5)
// (2,4,10) -> (6,8)
// (3,4,10) -> (9,9)
function testedRange (nodeIndex, nodeTotal, numberOfVersions) {
const nbFirsts = Math.ceil(numberOfVersions / nodeTotal)
if (nodeIndex === (nodeTotal - 1)) { return { firstVersion: nbFirsts * nodeIndex, lastVersion: numberOfVersions - 1 } }
return { firstVersion: nodeIndex * nbFirsts, lastVersion: (nodeIndex + 1) * nbFirsts - 1 }
}
console.log({ nodeIndex, nodeTotal, versions: mc.supportedVersions.length })
const { firstVersion, lastVersion } = parallel ? testedRange(nodeIndex, nodeTotal, mc.supportedVersions.length) : { firstVersion: 0, lastVersion: mc.supportedVersions.length - 1 }
module.exports = { firstVersion, lastVersion }

View file

@ -187,11 +187,7 @@ function getValue (_type, packet) {
}
}
const { firstVersion, lastVersion } = require('./common/parallel')
mc.supportedVersions.forEach(function (supportedVersion, i) {
if (!(i >= firstVersion && i <= lastVersion)) { return }
for (const supportedVersion of mc.supportedVersions) {
const PORT = Math.round(30000 + Math.random() * 20000)
const mcData = require('minecraft-data')(supportedVersion)
const version = mcData.version
@ -284,4 +280,4 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
})
}
})
})
}

View file

@ -4,7 +4,6 @@ const mc = require('../')
const assert = require('power-assert')
const { once } = require('events')
const { firstVersion, lastVersion } = require('./common/parallel')
const w = {
piglin_safe: {
type: 'byte',
@ -60,9 +59,7 @@ const w = {
}
}
mc.supportedVersions.forEach(function (supportedVersion, i) {
if (!(i >= firstVersion && i <= lastVersion)) { return }
for (const supportedVersion of mc.supportedVersions) {
const PORT = Math.round(30000 + Math.random() * 20000)
const mcData = require('minecraft-data')(supportedVersion)
const version = mcData.version
@ -430,4 +427,4 @@ mc.supportedVersions.forEach(function (supportedVersion, i) {
})
})
})
})
}