Skip to content

Commit

Permalink
Merge branch 'master' into TWEAKS
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticJay committed Aug 8, 2023
2 parents 75fe4b3 + d44c885 commit 467efc0
Show file tree
Hide file tree
Showing 203 changed files with 13,843 additions and 5,532 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ indent_size = 2

[*.py]
indent_size = 4
dashArray = [1,2];

# Following JS code style rules do not have EditorConfig support yet:
# - Use identity operators (===) over equality operators (==).
# - Opening brace at end of line. e.g. "if (a) {", "} else {", "} else if (b) }"
Expand Down
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
build
mobile
docs
json_examples
**/external
19 changes: 6 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
{
"env": {
"browser": true,
"es6": false,
"es6": true,
"jquery": true,
"greasemonkey": true
},
"extends": [
"eslint:recommended"
"eslint:recommended",
"plugin:prettier/recommended",
"prettier"
],
"ignorePatterns": [
"/core/external/*.js",
"/core/external/*.js",
"/plugins/external/*.js"
],
"plugins": ["prettier"],
"rules": {
"eqeqeq": "error",
"indent": ["warn", 2],
"brace-style": ["error","1tbs", { "allowSingleLine": true }],
"curly": ["error", "multi-line"],
"keyword-spacing": "error",
"spaced-comment": "error",
"quotes": ["error", "single", { "avoidEscape": true }],
"no-trailing-spaces": "error",
"max-len": ["warn", { "code": 160 }],
"semi": "error",
"eol-last": "error",
"quote-props": ["error","consistent-as-needed"],
"no-unused-expressions": "error"
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ['https://t.me/iitc_news/39', 'https://iitc.app/donate.html']
96 changes: 96 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build IITC and push artifacts

on:
push:
branches:
- master
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Set env BRANCH
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV

- name: Set env BUILD_TYPE and ARCHIVE_DIR (optional)
run: |
if [[ $BRANCH == 'master' ]]; then
echo "BUILD_TYPE=beta" >> "$GITHUB_ENV"
echo "ARCHIVE_DIR=beta_archive" >> "$GITHUB_ENV"
else
echo "BUILD_TYPE=release" >> "$GITHUB_ENV"
echo "ARCHIVE_DIR=release_archive" >> "$GITHUB_ENV"
fi
- name: Set env ENABLE_CHECK_APP_UPDATES
run: echo "ENABLE_CHECK_APP_UPDATES=true" >> "$GITHUB_ENV"

- name: Download localbuildsettings.py
run: wget https://iitc.app/deploy/localbuildsettings.py

- name: Run build.py
env:
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
ALIAS_NAME: ${{ secrets.ALIAS_NAME }}
ALIAS_PASS: ${{ secrets.ALIAS_PASS }}
run: ./build.py $BUILD_TYPE

- name: Set env with artifacts
run: |
echo "ARTIFACT_IITC_MOBILE=$( ls -d ./build/${{ env.BUILD_TYPE }}/* | grep '.apk' )" >> "$GITHUB_ENV"
echo "ARTIFACT_IITC_ZIP=$( ls -d ./build/${{ env.BUILD_TYPE }}/* | grep '.zip' )" >> "$GITHUB_ENV"
- name: Set env BUILDSTAMP
run: |
echo "BUILDSTAMP=$(date -u +'%Y-%m-%d_%H-%M' -d"$(stat -c %y ./build/${{ env.BUILD_TYPE }}/total-conversion-build.user.js)")" >> "$GITHUB_ENV"
- uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "./build/${{ env.BUILD_TYPE }}/*.zip,./build/${{ env.BUILD_TYPE }}/*.apk"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Send APK to Telegram
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }}
TG_THREAD_ID: ${{ secrets.TG_THREAD_ID }}
if: ${{ env.TG_BOT_TOKEN != ''}}
run: |
TEXT="🤖 *New IITC Mobile ${{ env.BUILD_TYPE }} build: *[${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})"
APIPARAMS="-F parse_mode=MarkdownV2 -F disable_notification=true -F chat_id=${{ env.TG_CHAT_ID }} -F is_topic_message=true -F message_thread_id=${{ env.TG_THREAD_ID }} https://api.telegram.org/bot${{ env.TG_BOT_TOKEN }}/sendDocument"
curl -s -F document=@"${{ env.ARTIFACT_IITC_MOBILE }}" -F caption="$TEXT" $APIPARAMS
- name: Save PR metadata
run: |
mkdir artifact
mv ./build/${{ env.BUILD_TYPE }} ./artifact/build
mkdir -p ./artifact/.metadata
echo ${{ env.BUILD_TYPE }} > ./artifact/.metadata/build_type
echo ${{ github.sha }} > ./artifact/.metadata/commit
echo $( ls ./artifact/build/ | grep '.apk' ) > ./artifact/.metadata/apk_filename
echo $( ls ./artifact/build/ | grep '.zip' ) > ./artifact/.metadata/zip_filename
echo $(date -u +'%Y-%m-%d_%H-%M' -d"$(stat -c %y ./artifact/build/total-conversion-build.user.js)") > ./artifact/.metadata/buildstamp
- uses: actions/upload-artifact@v2
with:
name: build
path: |
./artifact/.metadata/
./artifact/build/
54 changes: 54 additions & 0 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build PR

# read-only repo token
# no access to secrets
on:
pull_request:
paths-ignore:
- '!.github/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Set env BUILD_TYPE
run: |
echo "BUILD_TYPE=test" >> "$GITHUB_ENV"
- name: Download localbuildsettings.py
run: wget https://iitc.app/deploy/localbuildsettings.py

- name: Run build.py
env:
PR_NUMBER: ${{ github.event.number }}
run: ./build.py $BUILD_TYPE

- name: Save PR metadata
run: |
mv ./build/${{ env.BUILD_TYPE }} ./build/build
mkdir -p ./build/.metadata
echo "PR" > ./build/.metadata/build_type
echo ${{ github.event.number }} > ./build/.metadata/pr_number
echo ${{ github.event.pull_request.head.sha }} > ./build/.metadata/commit
echo $( ls ./build/build/ | grep '.apk' ) > ./build/.metadata/apk_filename
echo $( ls ./build/build/ | grep '.zip' ) > ./build/.metadata/zip_filename
echo $(date -u +'%Y-%m-%d_%H-%M' -d"$(stat -c %y ./build/build/total-conversion-build.user.js)") > ./build/.metadata/buildstamp
- uses: actions/upload-artifact@v2
with:
name: build
path: |
./build/.metadata/
./build/build/
23 changes: 23 additions & 0 deletions .github/workflows/merge_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: After PR merging

on:
pull_request:
types:
- closed

jobs:
if_merged:
runs-on: ubuntu-latest
steps:

- name: Delete PR artifact from website
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' }}
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.API_TOKEN_GITHUB }}
repository: ${{ env.WEBSITE_REPO }}
event-type: 'delete_iitc_pr_build'
client-payload: '{ "pr_number": "${{ github.event.number }}" }'

20 changes: 20 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: reviewdog

# read-only repo token
# no access to secrets
on:
pull_request:
paths-ignore:
- '!.github/**'

jobs:
eslint:
name: runner / eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-eslint@v1
with:
reporter: github-pr-review
level: error
fail_on_error: true
87 changes: 87 additions & 0 deletions .github/workflows/send_build_to_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Send build to website

# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Build PR", "Build IITC and push artifacts"]
types:
- completed

jobs:
upload:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v6
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' }}
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "build"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/build.zip`, Buffer.from(download.data));
core.exportVariable('REPO_OWNER', context.repo.owner);
core.exportVariable('REPO_NAME', context.repo.repo);
core.exportVariable('ARTIFACT_ID', matchArtifact.id);
- name: 'Unzip artifact'
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' && github.event.workflow_run.event == 'pull_request' }}
run: unzip build.zip

- name: Set env
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' && github.event.workflow_run.event == 'pull_request' }}
run: |
echo "PR_NUMBER=$(cat ./.metadata/pr_number)" >> "$GITHUB_ENV"
echo "COMMIT_HASH=$(cat ./.metadata/commit)" >> "$GITHUB_ENV"
echo "BUILD_APK_FILENAME=$(cat ./.metadata/apk_filename)" >> "$GITHUB_ENV"
echo "BUILD_ZIP_FILENAME=$(cat ./.metadata/zip_filename)" >> "$GITHUB_ENV"
echo "BUILDSTAMP=$(cat ./.metadata/buildstamp)" >> "$GITHUB_ENV"
- name: Comment with build url for PR
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' && github.event.workflow_run.event == 'pull_request' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr_release
number: ${{ env.PR_NUMBER }}
message: |
## 🤖 Pull request artifacts
| file | commit |
| ---- | ------ |
| [`${{ env.BUILD_APK_FILENAME }}`](https://github.com/${{ secrets.WEBSITE_REPO }}/raw/master/static/build/artifact/PR${{ env.PR_NUMBER }}/${{ env.BUILD_APK_FILENAME }}) | ${{ env.COMMIT_HASH }} |
| [`${{ env.BUILD_ZIP_FILENAME }}`](https://github.com/${{ secrets.WEBSITE_REPO }}/raw/master/static/build/artifact/PR${{ env.PR_NUMBER }}/${{ env.BUILD_ZIP_FILENAME }}) | ${{ env.COMMIT_HASH }} |
[See build on website](https://iitc.app/build/artifact/PR${{ env.PR_NUMBER }}/)
- name: Send build artifacts to website
env:
WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }}
if: ${{ env.WEBSITE_REPO != '' }}
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.API_TOKEN_GITHUB }}
repository: ${{ env.WEBSITE_REPO }}
event-type: 'new_iitc_build'
client-payload: '{ "repo": {"owner": "${{ env.REPO_OWNER }}", "repo": "${{ env.REPO_NAME }}"}, "artifact_id": "${{ env.ARTIFACT_ID }}" }'
9 changes: 7 additions & 2 deletions .idea/ingress-intel-total-conversion.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
build
mobile
docs
json_examples
**/external
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 160,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
Loading

0 comments on commit 467efc0

Please sign in to comment.