Skip to content

Commit

Permalink
Improve CI per version setup (#3256)
Browse files Browse the repository at this point in the history
- use +v to select the version properly (eg don't run all 1.19.x for 1.19)
- run on all tested versions specified in version.js
  • Loading branch information
rom1504 authored Dec 27, 2023
1 parent 70a652e commit 48c3ca7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,44 @@ jobs:
with:
node-version: 18.x
- run: npm i && npm run lint

PrepareSupportedVersions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18.x
- id: set-matrix
run: |
node -e "
const testedVersions = require('./lib/version').testedVersions;
console.log('matrix='+JSON.stringify({'include': testedVersions.map(mcVersion => ({mcVersion}))}))
" >> $GITHUB_OUTPUT
MinecraftServer:
needs: PrepareSupportedVersions
runs-on: ubuntu-latest
strategy:
matrix:
javaVersion: [1.8]
mcVersion: ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5']
include:
- javaVersion: 16
mcVersion: '1.17.1'
- javaVersion: 17
mcVersion: '1.18.2'
- javaVersion: 17
mcVersion: '1.19'
- javaVersion: 17
mcVersion: '1.19.2'
- javaVersion: 17
mcVersion: '1.19.3'
- javaVersion: 17
mcVersion: '1.19.4'
- javaVersion: 17
mcVersion: '1.20.1'
matrix: ${{fromJson(needs.PrepareSupportedVersions.outputs.matrix)}}
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18.x
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: ${{ matrix.javaVersion }}
java-version: 17
java-package: jre
- name: Install Dependencies
run: npm install
- name: Start Tests
run: npm run mocha_test -- -g ${{ matrix.mcVersion }}
run: npm run mocha_test -- -g ${{ matrix.mcVersion }}v
2 changes: 1 addition & 1 deletion lib/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
supportedVersions: ['1.8', '1.9', '1.10', '1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20'],
testedVersions: ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1']
} // when updating testedVersions, make sure to update CI.yml
}
2 changes: 1 addition & 1 deletion test/externalTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for (const supportedVersion of mineflayer.testedVersions) {
console.log(line)
})

describe(`mineflayer_external ${version.minecraftVersion}`, function () {
describe(`mineflayer_external ${supportedVersion}v`, function () {
let bot
this.timeout(10 * 60 * 1000)
before(async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/internalTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for (const supportedVersion of mineflayer.testedVersions) {
}
}

describe(`mineflayer_internal ${version.minecraftVersion}`, function () {
describe(`mineflayer_internal ${supportedVersion}v`, function () {
this.timeout(10 * 1000)
let bot
let server
Expand Down

1 comment on commit 48c3ca7

@Alex-AdminD
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WSP

Please sign in to comment.