Skip to content

Commit

Permalink
✨ ci
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX committed May 18, 2022
1 parent 2ac6394 commit da27988
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 18 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
yarn
mkdir builds
- name: Test build
run: |
python preset_build.py
node preset_build.js
- name: Upload files built
uses: actions/upload-artifact@v2
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Lib/
Scripts/
pyvenv.cfg
!/news.json
!/alerts.json
!/alerts.json
node_modules
!package.json
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"glob": "^8.0.3",
"memepack-builder": "^0.2.0-beta.0"
}
}
89 changes: 89 additions & 0 deletions preset_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
const { JavaPackBuilder, ModuleParser, Logger } = require('memepack-builder')
const { readFileSync, fstat, writeFileSync } = require('fs')
const { resolve } = require('path')
const glob = require('glob')
const PACK_VERSION = '1.6.1'

const preset_args = [
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': [], 'collection': [
'choice_modules_1']
}, 'mod': [], 'format': 7, compatible: false
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': ['lang_sfw'], 'collection': [
'choice_modules_1']
}, 'mod': ['all'], 'format': 7, compatible: false
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': [
'lang_sfw'], 'collection': []
}, 'mod': [], 'format': 7, compatible: false
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': [
'lang_sfw'], 'collection': []
}, 'mod': [], 'format': 7, compatible: false
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': ['lang_sfw'], 'collection': [
'choice_modules_1']
}, 'mod': ['all'], 'format': 7, compatible: true
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': ['lang_sfw'], 'collection': [
'choice_modules_1']
}, 'mod': [], 'format': 7, compatible: true
},
{
'platform': 'java', 'type': 'normal', 'modules': {
'resource': [
'lang_sfw'], 'collection': []
}, 'mod': [], 'format': 7, compatible: true
},
{
'platform': 'java', 'type': 'legacy', 'modules': {
'resource': ['lang_sfw'], 'collection': [
'version_1.12.2-1.15.2']
}, 'mod': [], 'format': 3, compatible: false
}
]
const preset_name = [
`mcwzh-meme_v${PACK_VERSION}.zip`,
`mcwzh-meme_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_nomod_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_nomod_noresource_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_nomod_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_nomod_noresource_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_legacy_nomod_noresource_sfw_v${PACK_VERSION}.zip`
]


async function start() {
const jeModules = new ModuleParser(resolve(__dirname, './modules'))
const je = new JavaPackBuilder(await jeModules.moduleInfo(), resolve(__dirname, './meme_resourcepack'), {
modFiles: glob.sync('./mods/*.json')
})
for (const [i, arg] of preset_args.entries()) {
try {
let r = await je.build(arg)
console.log(arg, preset_name[i])
writeFileSync(resolve(__dirname, `./builds/${preset_name[i]}`), r.content)

} catch (e) {
console.error(Logger.log, e)
Logger.clearLog()
process.exit(1)
}
}
process.exit(0)
}

start()
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

129 changes: 129 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"

buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==

fs-extra@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=

glob@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e"
integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^5.0.1"
once "^1.3.0"

graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==

inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"

inherits@2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==

jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"

klaw@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/klaw/-/klaw-4.0.1.tgz#8dc6f5723f05894e8e931b516a8ff15c2976d368"
integrity sha512-pgsE40/SvC7st04AHiISNewaIMUbY5V/K8b21ekiPiFoYs/EYSdsGa+FJArB1d441uq4Q8zZyIxvAzkGNlBdRw==

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

memepack-builder@^0.2.0-beta.0:
version "0.2.0-beta.0"
resolved "https://registry.yarnpkg.com/memepack-builder/-/memepack-builder-0.2.0-beta.0.tgz#b8fe1a30d26411fc4945aab059ec455852368b96"
integrity sha512-J9pat4Hr/v/quoZ0tMUH/yCKP0dTY5+InC7hXbvb4Rza5101ImO7qX2oTpfx0W0S9gP5GyPNsWXSJJ8zbRHHCQ==
dependencies:
fs-extra "^10.1.0"
klaw "^4.0.1"
lodash "^4.17.21"
tslib "^2.4.0"
yazl "^2.5.1"

minimatch@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7"
integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==
dependencies:
brace-expansion "^2.0.1"

once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"

tslib@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=

yazl@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35"
integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==
dependencies:
buffer-crc32 "~0.2.3"

0 comments on commit da27988

Please sign in to comment.