Skip to content

Commit

Permalink
Merge branch 'huyna_s_creditami' of https://github.com/Anorak2024/Par…
Browse files Browse the repository at this point in the history
…adise into huyna_s_creditami
  • Loading branch information
Anorak2024 committed Oct 16, 2024
2 parents 7ad3096 + 7aeddd7 commit a4236a6
Show file tree
Hide file tree
Showing 40 changed files with 2,939 additions and 1,636 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@
*.png binary
*.so binary

## Merger hooks, run tools/hooks/install.bat or install.sh to set up
## Merge hooks, run tools/hooks/install.bat or install.sh to set up
*.dmm text eol=lf merge=dmm
*.dmi binary merge=dmi

## TGUI bundle merge drivers
*.bundle.* binary merge=tgui-merge-bundle
*.chunk.* binary merge=tgui-merge-bundle

## Force tab indents on dm files
*.dm whitespace=indent-with-non-tab

9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Setup Cache
uses: actions/cache@v4
with:
Expand All @@ -37,13 +38,19 @@ jobs:
python-version: '3.11.6'
cache: 'pip'

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ./tgui/yarn.lock

- name: Install python packages
run: pip3 install -r tools/requirements.txt

- name: Run Linters
run: |
find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/ci/json_verifier.py
tools/ci/build_tgui.sh
tgui/bin/tgui --ci
tools/ci/check_grep.sh
python3 tools/ci/check_line_endings.py
python3 tools/ci/unticked_files.py ${GITHUB_WORKSPACE}
Expand Down
97 changes: 87 additions & 10 deletions .github/workflows/testmerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
BASE_BRANCH: master220
TESTMERGE_BRANCH: testmerge2
TESTMERGE_BRANCH: testmerge
REQUIRED_LABEL: testmerge

jobs:
Expand All @@ -25,16 +25,23 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'updated',
direction: 'desc',
per_page: 100
});
const labeledPRs = [];
for (const pr of pullRequests) {
const sortedPRsASC = pullRequests.sort((a, b) => a.created_at.localeCompare(b.created_at));
for (const pr of sortedPRsASC) {
if (pr.labels.some(label => label.name === label_needed)) {
const prInfo = await github.rest.pulls.get({
console.log(`PR ${pr.title}`);
const { data: prInfo } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number
});
if (prInfo.data.mergeable) {
if (prInfo.mergeable) {
labeledPRs.push({
number: pr.number,
title: pr.title
Expand All @@ -43,53 +50,123 @@ jobs:
}
}
const prDetails = JSON.stringify(labeledPRs);
console.log(`Pull Requests with the label "${label_needed}" and no merge conflicts: ${prDetails}`);
console.log(`Pull Requests with the label "${label_needed}" and no merge conflicts:\n${prDetails}`);
if (prDetails.length == 0) {
core.setFailed(`No pull requests with the label "${label_needed}" and no merge conflicts found.`);
}
core.setOutput('labeled_pr_details', prDetails);
- name: Git checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ env.BASE_BRANCH }}

- uses: actions/setup-python@v5
with:
python-version: '3.11.6'
cache: 'pip'

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache-dependency-path: ./tgui/yarn.lock

- name: Install python packages
run: |
pip3 install -r tools/requirements.txt
pip3 install GitPython
- name: Iterate over PRs and perform actions
id: prepare_testmerge_branch
run: |
set -e
# Define the color functions
red() {
echo -e "\033[31m$1\033[0m"
}
green() {
echo -e "\033[32m$1\033[0m"
}
yellow() {
echo -e "\033[33m$1\033[0m"
}
git config --local user.email "action@github.com"
git config --local user.name "Testmerge Worker"
git switch ${{ env.TESTMERGE_BRANCH }} || git switch -c ${{ env.TESTMERGE_BRANCH }}
git reset --hard ${{ env.BASE_BRANCH }}
./tools/hooks/install.sh
./tgui/bin/tgui --install-git-hooks
MERGED_PRS=()
# Print debug information
echo "PR details JSON:"
echo '${{ steps.get_labeled_prs.outputs.labeled_pr_details }}'
echo '${{ steps.get_labeled_prs.outputs.labeled_pr_details }}' | jq -c '.[]' | while read -r PR_DETAIL; do
PR_NUMBER=$(echo "$PR_DETAIL" | jq -r '.number')
PR_TITLE=$(echo "$PR_DETAIL" | jq -r '.title')
echo "Preparing $PR_TITLE (#$PR_NUMBER)"
git fetch origin pull/$PR_NUMBER/head:pr-$PR_NUMBER
PR_LAST_COMMIT=$(git rev-parse --short pr-$PR_NUMBER | head -c 7)
PR_STRING="$PR_TITLE (#$PR_NUMBER) [$PR_LAST_COMMIT]"
echo "::group::$PR_STRING"
echo "Preparing..."
# Check for merge conflicts
git merge --no-commit --no-ff pr-$PR_NUMBER || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ] ; then
echo "There is a merge conflict. Skipping $PR_TITLE (#$PR_NUMBER)"
echo "::endgroup::"
echo "$(red "$PR_STRING: There is a merge conflict. Skipping!")"
git merge --abort
continue
fi
git merge --abort
git merge --squash pr-$PR_NUMBER
git commit -m "$PR_TITLE (#$PR_NUMBER) [testmerge]"
git commit -m "$PR_TITLE (#$PR_NUMBER) [testmerge][$PR_LAST_COMMIT]"
# Perform your git actions here, for example:
echo "Successfully merged $PR_TITLE (#$PR_NUMBER)"
echo "::endgroup::"
echo "$(green "$PR_STRING: Successfully merged!")"
MERGED_PRS+=("$PR_NUMBER")
done
# Generate changelog
python3 tools/changelog/gen_changelog.py
git add html/changelogs/archive/\*.yml
CHANGES=$(git diff --name-only --cached | wc -l)
if [ "$CHANGES" -gt 0 ] ; then
git config --local user.email "action@github.com"
git config --local user.name "Changelog Generation"
git commit -m "Automatic changelog generation"
fi
git push -f origin ${{ env.TESTMERGE_BRANCH }}
# Output the list of merged PRs
echo "merged_prs=${MERGED_PRS[*]}" >> $GITHUB_OUTPUT
- name: Comment on merged PRs
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const mergedPRs = '${{ steps.prepare_testmerge_branch.outputs.merged_prs }}'.split(' ');
for (const prNumber of mergedPRs) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(prNumber),
body: 'Данный PR был добавлен в ветку "${{ env.TESTMERGE_BRANCH }}" для тестов. Он попадёт на сервер после деплоя.'
});
console.log(`Commented on PR #${prNumber}`);
}
4 changes: 2 additions & 2 deletions _build_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file has all the information on what versions of libraries are thrown into the code
# For dreamchecker
export SPACEMANDMM_TAG=suite-1.8
export SPACEMANDMM_TAG=suite-1.9
# For TGUI
export NODE_VERSION=18
export NODE_VERSION=20
# Stable Byond Major
export STABLE_BYOND_MAJOR=515
# Stable Byond Minor
Expand Down
Loading

0 comments on commit a4236a6

Please sign in to comment.