Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
OctusGit committed Apr 9, 2024
2 parents 80e8a1c + de891f6 commit e8c1238
Show file tree
Hide file tree
Showing 1,729 changed files with 62,898 additions and 71,533 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 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
32 changes: 23 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ All new user interfaces in the game must be created using the TGUI framework. Do

The use of the `:` operator to override type safety checks is not allowed. You must cast the variable to the proper type.

### Do not access return value vars directly from functions

The use of the pointer operator, `.`, should not be used to access the return values of functions directly. This can cause unintended behavior and is difficult to read.

```dm
//Bad
var/our_x = get_turf(thing).x
//Good
var/turf/our_turf = get_turf(thing)
var/our_x = our_turf.x
```

### Type paths must begin with a /

eg: `/datum/thing`, not `datum/thing`
Expand Down Expand Up @@ -457,15 +470,15 @@ Look for code examples on how to properly use it.

#### Bitflags

* We prefer using bitshift operators instead of directly typing out the value. I.E:
* Bitshift operators are mandatory, opposed to directly typing out the value. I.E:

```dm
#define MACRO_ONE (1<<0)
#define MACRO_TWO (1<<1)
#define MACRO_THREE (1<<2)
```

Is preferable to:
Is accepted, whereas the following is not:

```dm
#define MACRO_ONE 1
Expand Down Expand Up @@ -775,7 +788,7 @@ Each role inherits the lower role's responsibilities (IE: Headcoders also have c
`Headcoders` are the overarching "administrators" of the repository. People included in this role are:

* [farie82](https://github.com/farie82)
* [Charliminator](https://github.com/hal9000PR)
* [S34N](https://github.com/S34NW)
* [SteelSlayer](https://github.com/SteelSlayer)

---
Expand All @@ -784,21 +797,22 @@ Each role inherits the lower role's responsibilities (IE: Headcoders also have c


* [AffectedArc07](https://github.com/AffectedArc07)
* [Charliminator](https://github.com/hal9000PR)
* [Contrabang](https://github.com/Contrabang)
* [lewcc](https://github.com/lewcc)
* [S34N](https://github.com/S34NW)

---

`Review Team` members are people who are denoted as having reviews which can affect mergeability status. People included in this role are:

* [lewcc](https://github.com/lewcc)
* [S34N](https://github.com/S34NW)
* [Sirryan2002](https://github.com/Sirryan2002)
* [Contrabang](https://github.com/Contrabang)
* [Burzah](https://github.com/Burzah)
* [Charliminator](https://github.com/hal9000PR)
* [Contrabang](https://github.com/Contrabang)
* [DGamerL](https://github.com/DGamerL)
* [Warriorstar](https://github.com/warriorstar-orion)
* [Henri215](https://github.com/Henri215)
* [lewcc](https://github.com/lewcc)
* [Sirryan2002](https://github.com/Sirryan2002)
* [Warriorstar](https://github.com/warriorstar-orion)

---

Expand Down
32 changes: 20 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,55 @@ on:
pull_request:
branches:
- master
merge_group:

jobs:
run_linters:
name: Run Linters
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Setup Cache
uses: actions/cache@v4
with:
path: $HOME/SpacemanDMM
key: ${{ runner.os }}-spacemandmm

- name: Install Tools
run: |
bash tools/ci/install_build_deps.sh
bash tools/ci/install_dreamchecker.sh
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
cache: 'pip'

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

- run: pip install -r tools/requirements.txt
- name: Run Linters
run: |
tools/ci/check_json.sh
tools/ci/build_tgui.sh
tgui/bin/tgui --ci
python tools/ci/check_grep2.py
python tools/ci/check_line_endings.py
python tools/ci/check_file_names.py
python tools/ci/unticked_files.py ${GITHUB_WORKSPACE}
python tools/ci/illegal_dme_files.py ${GITHUB_WORKSPACE}
python tools/ci/define_sanity.py
python -m tools.ci.check_icon_conflicts
python -m tools.ci.check_icon_dupenames
python -m tools.maplint.source --github
DREAMCHECKER_EXIT_CODE=0
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1 || DREAMCHECKER_EXIT_CODE=$?
echo 'DREAMCHECKER_ANNOTATED=1' >> "$GITHUB_ENV"
exit $DREAMCHECKER_EXIT_CODE
- name: Annotate Lints
uses: yogstation13/DreamAnnotate@v2
if: ${{ always() && env.DREAMCHECKER_ANNOTATED == '1' }}
with:
outputFile: output-annotations.txt
- name: Run DreamChecker
shell: bash
run: ~/dreamchecker 2>&1 | bash tools/ci/annotate_dm.sh

odlint:
name: Lint with OpenDream
Expand Down Expand Up @@ -83,7 +91,7 @@ jobs:
strategy:
fail-fast: false # Let all map tests run to completion
matrix:
maptype: ['/datum/map/cyberiad', '/datum/map/delta', '/datum/map/metastation', '/datum/map/cerestation']
maptype: ['/datum/map/boxstation', '/datum/map/deltastation', '/datum/map/metastation', '/datum/map/cerestation']
byondtype: ['STABLE']
services:
mariadb:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/label_stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Label and close stale PRs and Issues

on:
schedule:
- cron: '0 0 * * *' # Runs at midnight UTC every day

jobs:
stale-prs:
runs-on: ubuntu-latest
steps:
- name: Seek and destroy stale PRs and Issues
uses: actions/stale@v9
with:
stale-pr-message: 'This pull request seems to be stale as there have been no changes in 14 days, please make changes within 7 days or the PR will be closed. If you believe this is a mistake, please inform a development team member on Discord.'
close-pr-message: 'This pull request has not received any updates since being marked stale, and as such is now being automatically closed. Please feel free to re-open this pull request or open a new one once you have new updates.'
stale-issue-message: 'This issue either requires verification or is unreproducible, but has had no updates for 60 days. Please provide an update within 14 days or this issue will be closed. If you believe this is a mistake, please contact an issue manager on Discord.'
close-issue-message: 'This issue was marked as stale, yet no changes have been observed in the specified time. The issue has been closed.'
days-before-stale: 14
days-before-issue-stale: 60
days-before-close: 7
days-before-issue-close: 14
exempt-issue-labels: '"Stale Exempt"'
exempt-pr-labels: '"Stale Exempt", "-Status: Awaiting approval", "-Status: Awaiting Merge", "-Status: Awaiting type assignment"'
any-of-issue-labels: '"Need Verification", "Cannot Reproduce", "Not A Bug", "(99% Sure) Not A Bug"'
115 changes: 115 additions & 0 deletions .github/workflows/merge_upstream_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Merge Upstream Master
on:
issue_comment:
types: created

jobs:
merge-upstream:
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '!merge_upstream') &&
((github.event.sender.id == github.event.issue.user.id) ||
(github.event.comment.author_association == 'COLLABORATOR') ||
(github.event.comment.author_association == 'MEMBER') ||
(github.event.comment.author_association == 'OWNER'))
runs-on: ubuntu-latest
steps:
- id: create_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- run: echo "GH_TOKEN=${{ steps.create_token.outputs.token }}" >> "$GITHUB_ENV"
- run: echo "FAIL_NOTIFIED=false" >> "$GITHUB_ENV"

- name: Like the comment
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/ParadiseSS13/Paradise/issues/comments/${{ github.event.comment.id }}/reactions \
-f content='+1'
- name: PR Data
run: |
pr_json=$(curl -L -s --fail-with-body -H "Authorization: token ${{ github.token }}" ${{ github.event.issue.pull_request.url }})
if [ `jq -r '.maintainer_can_modify' <<<$pr_json` == "false" ] ; then
gh pr comment ${{ github.event.issue.html_url }} --body 'GitHub Actions can not push to the repository without "Allow edits and access to secrets by maintainers" checked.'
echo "FAIL_NOTIFIED=true" >> "$GITHUB_ENV"
exit 1
fi
echo "PR_REPO=`jq -r '.head.repo.full_name' <<<$pr_json`" >> $GITHUB_ENV
echo "PR_BRANCH=`jq -r '.head.ref' <<<$pr_json`" >> $GITHUB_ENV
echo "PR_HEAD_LABEL=`jq -r '.head.label' <<<$pr_json`" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: ${{ env.PR_REPO }}
ref: ${{ env.PR_BRANCH }}
token: ${{ env.GH_TOKEN }}

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

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

- name: Perform Merge
env:
BASE_BRANCH: ${{ github.event.repository.default_branch }}
BASE_REPOSITORY: ${{ github.repository }}
run: |
# Compare head branch and base branch
compare_result=$(curl -L -s --fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$BASE_REPOSITORY/compare/$BASE_BRANCH...$PR_HEAD_LABEL")
# Assign multiple variables with one jq execution
if IFS=$'\n' read -d '' -r behind_by ahead_by <<<$(jq '.behind_by, .ahead_by' <<<$compare_result) ; [ -z "$behind_by" ] || [ -z "$ahead_by" ] ; then
echo '- Unable to determine the distance between the head branch and the base branch.' | tee -a "$GITHUB_STEP_SUMMARY"
exit 1
fi
if [ "$behind_by" -le 0 ] ; then
echo '- Skipping merge. Up-to-date with base branch.' | tee -a "$GITHUB_STEP_SUMMARY"
exit 0
else
echo '- Merging base branch. Head branch is behind by '"$behind_by"' commits and ahead by '"$ahead_by"' commits.' | tee -a "$GITHUB_STEP_SUMMARY"
fi
# Install Tools
chmod +x tools/bootstrap/python
bash tools/hooks/install.sh
bash tgui/bin/tgui --install-git-hooks
chmod +x tools/hooks/*.merge tgui/bin/tgui
# Actual Merge
git config user.name paradisess13[bot]
git config user.email "165046124+paradisess13[bot]@users.noreply.github.com"
git remote add upstream "https://github.com/$BASE_REPOSITORY.git"
git fetch origin "$PR_BRANCH" --depth=$((ahead_by + 1))
git fetch upstream "$BASE_BRANCH" --depth=$((behind_by + 1))
# Check if a workflow file would be modified by the merge (permissions prevent pushes if so)
latest_workflow_commit=$(git log -n 1 --pretty=format:"%H" upstream/$BASE_BRANCH -- .github/workflows)
if ! git branch --contains $latest_workflow_commit | grep -q "$(git rev-parse --abbrev-ref HEAD)"; then
gh pr comment ${{ github.event.issue.html_url }} --body "GitHub Actions can not push to this branch as workflow files have been changed since your branch was last updated. Please update your branch past https://github.com/ParadiseSS13/Paradise/commit/$latest_workflow_commit before using this command again."#
echo "FAIL_NOTIFIED=true" >> "$GITHUB_ENV"
exit 1
fi
git merge FETCH_HEAD
git push origin
- name: Notify Failure
if: failure() && env.FAIL_NOTIFIED != 'true'
run: |
gh pr comment ${{ github.event.issue.html_url }} -b 'Merging upstream failed, see the action run log for details: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
29 changes: 12 additions & 17 deletions .github/workflows/render_nanomaps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ on:
- cron: "0 0 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
generate_maps:
permissions:
contents: write # for Git to git push
pull-requests: write # for repo-sync/pull-request to create pull requests
name: 'Generate NanoMaps'
runs-on: ubuntu-22.04
steps:
- id: create_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- run: echo "GH_TOKEN=${{ steps.create_token.outputs.token }}" >> "$GITHUB_ENV"

- name: 'Update Branch'
uses: actions/checkout@v4
with:
token: ${{ steps.create_token.outputs.token }}

- name: Branch
run: |
Expand All @@ -32,20 +36,11 @@ jobs:
- name: 'Generate Maps'
run: './tools/github-actions/nanomap-renderer-invoker.sh'

- name: 'Commit Maps'
- name: 'Commit Maps and open PR'
run: |
git config --local user.email "[email protected]"
git config --local user.name "NanoMap Generation"
git pull origin master
git commit -m "NanoMap Auto-Update (`date`)" -a || true
git push -f -u origin nanomap-render
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: "nanomap-render"
destination_branch: "master"
pr_title: "Automatic NanoMap Update"
pr_body: "This pull request updates the server NanoMaps. Please review the diff images before merging."
pr_label: "NanoMaps"
pr_allow_empty: false
gh pr create -t "Automatic NanoMap Update" -b "This pull request updates the server NanoMaps. Please review the diff images before merging." -l "NanoMaps" -H "nanomap-render" -B "master"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*.dmb
*.lk

# ignore tmp files generated by icon save operations
/tmp/*

#ignore any files in config/, except those in subdirectories.
/config/*
!config/**/*/
Expand All @@ -26,6 +29,7 @@ stddef.dm
*.vscode/*
!/.vscode/extensions.json
!/.vscode/tasks.json
!/.vscode/launch.json

# ignore DMI tool build cache
/tools/dmitool/bin/
Expand Down
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "byond",
"request": "launch",
"name": "Build & DS Debug",
"preLaunchTask": "dm: build - ${command:CurrentDME}",
"dmb": "${workspaceFolder}/${command:CurrentDMB}"
},
{
"type": "byond",
"request": "launch",
"name": "DS Debug",
"dmb": "${workspaceFolder}/${command:CurrentDMB}"
}
]
}
Loading

0 comments on commit e8c1238

Please sign in to comment.