From 31079e4ebf78794d489deb31db2852713af0ddb2 Mon Sep 17 00:00:00 2001 From: Refringe Date: Sun, 24 Nov 2024 22:58:59 -0500 Subject: [PATCH] Github Migration - Workflows & Issue Template - Replaces the Gitea workflows with Github workflows. - Adds a Github issue template. (The reason this is being done directly on master is because it's the branch that the issue templates load from.) --- .gitea/workflows/build-trigger.yaml | 35 ------ .gitea/workflows/run-lint.yaml | 59 ---------- .gitea/workflows/run-test.yaml | 73 ------------- .github/issue_template/1-bug-report.yml | 101 ++++++++++++++++++ .github/issue_template/config.yml | 8 ++ .github/workflows/build-trigger.yaml | 22 ++++ .../workflows/clear-itemdb-cache.yaml | 4 +- .github/workflows/run-lint.yaml | 29 +++++ .github/workflows/run-test.yaml | 29 +++++ 9 files changed, 192 insertions(+), 168 deletions(-) delete mode 100644 .gitea/workflows/build-trigger.yaml delete mode 100644 .gitea/workflows/run-lint.yaml delete mode 100644 .gitea/workflows/run-test.yaml create mode 100644 .github/issue_template/1-bug-report.yml create mode 100644 .github/issue_template/config.yml create mode 100644 .github/workflows/build-trigger.yaml rename {.gitea => .github}/workflows/clear-itemdb-cache.yaml (92%) create mode 100644 .github/workflows/run-lint.yaml create mode 100644 .github/workflows/run-test.yaml diff --git a/.gitea/workflows/build-trigger.yaml b/.gitea/workflows/build-trigger.yaml deleted file mode 100644 index 007e514c..00000000 --- a/.gitea/workflows/build-trigger.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Trigger Main Build Pipeline - -on: - push: - tags: - - '*' - -jobs: - trigger-main-build: - runs-on: ubuntu-latest - steps: - - name: Setup Git Config - run: | - git config --global user.email "noreply@sp-tarkov.com" - git config --global user.name "TriggerBot" - - - name: Clone Build Repository - run: | - rm -rf ../Build - git clone https://${{ secrets.BUILD_USERNAME }}:${{ secrets.BUILD_ACCESS_TOKEN }}@dev.sp-tarkov.com/SPT/Build.git ../Build - - - name: Trigger Branch - working-directory: ../Build - run: git checkout -b trigger || git checkout trigger - - - name: Create Trigger File - working-directory: ../Build - run: | - echo "${GITHUB_REF_NAME}" > .gitea/trigger - git add .gitea/trigger - git commit -m "Server triggered build with tag '${GITHUB_REF_NAME}'" - - - name: Force Push - working-directory: ../Build - run: git push --force origin trigger diff --git a/.gitea/workflows/run-lint.yaml b/.gitea/workflows/run-lint.yaml deleted file mode 100644 index c831d8e2..00000000 --- a/.gitea/workflows/run-lint.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Run Code Linter - -on: - push: - branches: '*' - pull_request: - branches: '*' - -jobs: - biome: - runs-on: ubuntu-latest - container: - image: refringe/spt-build-node:1.0.7 - steps: - - name: Clone - run: | - rm -rf /workspace/SPT/Build/server - git clone https://dev.sp-tarkov.com/${GITHUB_REPOSITORY}.git --branch master /workspace/SPT/Build/server - - cd /workspace/SPT/Build/server - git checkout ${GITHUB_SHA} - shell: bash - - - name: Pull LFS Files - run: | - cd /workspace/SPT/Build/server - git lfs pull - git lfs ls-files - shell: bash - - - name: Cache NPM Dependencies - id: cache-npm-dependencies - uses: actions/cache@v4 - with: - path: /workspace/SPT/Build/server/project/node_modules - key: npm-dependencies-${{ hashFiles('/workspace/SPT/Build/server/project/package.json') }} - - - name: Install NPM Dependencies - if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' - run: | - cd /workspace/SPT/Build/server/project - rm -rf node_modules - npm install - shell: bash - - - name: Run Linter - id: run-tests - run: | - cd /workspace/SPT/Build/server/project - npm run lint - shell: bash - - - name: Fix Instructions - if: failure() && steps.run-tests.outcome == 'failure' - run: | - echo -e "Code linting has failed. The linter has been configured to look for coding errors, defects, questionable patterns, and code formatting issues. Please look into resolving these errors. The linter may be able to resolve some of these issues automatically. You can launch the automatic fixer by running the following command from within the 'project' directory. Anything not resolved by running this command must be resolved manually.\n\nnpm run lint:fix\n" - echo -e "To automatically format code on-save in your IDE, please install the recommended VSCode plugins listed within the 'project/Server.code-workspace' file.\n" - echo -e "Consistency is professionalism.™" - shell: bash diff --git a/.gitea/workflows/run-test.yaml b/.gitea/workflows/run-test.yaml deleted file mode 100644 index 38a5338f..00000000 --- a/.gitea/workflows/run-test.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: Run Tests - -on: - push: - branches: '*' - pull_request: - branches: '*' - -jobs: - vitest: - runs-on: ubuntu-latest - if: > # Conditional to limit runs: checks if it's NOT a push to a branch with an open PR - github.event_name == 'push' || - github.event.pull_request.head.repo.full_name != github.repository - container: - image: refringe/spt-build-node:1.0.7 - steps: - - name: Clone - run: | - # For pull request events, checkout using GITHUB_SHA - # For push events, checkout using GITHUB_REF_NAME - if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then - REF=${GITHUB_SHA} - else - REF=${GITHUB_REF_NAME} - fi - - rm -rf /workspace/SPT/Server/current - git clone https://dev.sp-tarkov.com/${{ github.repository }}.git /workspace/SPT/Server/current - - cd /workspace/SPT/Server/current - git fetch - git checkout $REF - env: - GITHUB_SHA: ${{ github.sha }} - GITHUB_REF_NAME: ${{ github.ref_name }} - GITHUB_EVENT_NAME: ${{ github.event_name }} - shell: bash - - - name: Pull LFS Files - run: | - cd /workspace/SPT/Server/current && ls -lah - git lfs pull && git lfs ls-files - shell: bash - - - name: Cache NPM Dependencies - id: cache-npm-dependencies - uses: actions/cache@v4 - with: - path: /workspace/SPT/Server/current/project/node_modules - key: npm-dependencies-${{ hashFiles('/workspace/SPT/Server/current/project/package.json') }} - - - name: Install NPM Dependencies - if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' - run: | - cd /workspace/SPT/Server/current/project - rm -rf /workspace/SPT/Server/current/project/node_modules - npm install - shell: bash - - - name: Run Tests - id: run-tests - run: | - cd /workspace/SPT/Server/current/project - npm run test - shell: bash - - - name: Fix Instructions - if: failure() && steps.run-tests.outcome == 'failure' - run: | - echo -e "Automated tests have failed. This could point to an issue with the committed code, or an updated test that has yet to be updated. Please look into resolving these test failures. The testing suite has a GUI to aid in writing tests. You can launch this by running the following command from within the 'project' directory.\n\nnpm run test:ui\n" - echo -e "A test written today is a bug prevented tomorrow.™" - shell: bash diff --git a/.github/issue_template/1-bug-report.yml b/.github/issue_template/1-bug-report.yml new file mode 100644 index 00000000..72dfe3c8 --- /dev/null +++ b/.github/issue_template/1-bug-report.yml @@ -0,0 +1,101 @@ +name: "Bug Report" +description: "Report a bug in the SPT project." +labels: ["triage"] +body: + - type: markdown + attributes: + value: | + ## Thank you for taking the time to fill out a bug report! + + Please note the following requirements: + + - You must be able to replicate the issue with a fresh profile, running no mods. If you can't, we can't fix it. + - If you are using a profile from an older version, please make a fresh profile and replicate the issue before submitting. + - You must upload all the required log files, even if you think they are useless. + - Failure to comply with any of the above requirements will result in your issue being closed without notice. + - type: dropdown + id: version + attributes: + label: SPT Version + description: What version of SPT are you using? + options: + - "3.10" + - "3.9" + validations: + required: true + - type: dropdown + id: projects + attributes: + label: "Project Type" + description: "If known, which part of the project is involved in this bug report?" + options: + - "Server" + - "Modules" + - "Launcher" + multiple: true + validations: + required: false + - type: textarea + id: result_expected + attributes: + label: "Expected Result" + description: "What you expect to happen?" + validations: + required: true + - type: textarea + id: result_actual + attributes: + label: "Actual Result" + description: "What actually happened?" + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: "Steps To Reproduce" + description: "Describe in point form the steps we can take to reproduce the issue on our end." + validations: + required: true + - type: textarea + id: log_server + attributes: + label: "Server Log" + description: "Upload a copy of your *entire* server log: `/user/logs/server-.log`." + value: "Click and attach file. ↓" + validations: + required: true + - type: textarea + id: log_bepinex + attributes: + label: "BepinEx Log" + description: "Upload a copy of your *entire* BepinEx log: `/BepinEx/LogOutput.log`." + value: "Click and attach file. ↓" + validations: + required: true + - type: textarea + id: log_client + attributes: + label: "Client Log" + description: "Upload a copy of your *entire* client log: `/Logs/log__/_ traces.log`." + value: "Click and attach file. ↓" + validations: + required: true + - type: textarea + id: profile + attributes: + label: "Player Profile" + description: "If helpful, upload a copy of your *entire* player profile: `/user/profiles/.json`." + validations: + required: false + - type: textarea + id: screenshots + attributes: + label: "Screenshots" + description: "If helpful, upload any screenshots or videos you think would help us identify the issue." + validations: + required: false + - type: markdown + attributes: + value: | + ## BEFORE YOU SUBMIT + Ensure that your logs are attached. No logs = Issue deleted. diff --git a/.github/issue_template/config.yml b/.github/issue_template/config.yml new file mode 100644 index 00000000..7a39f4de --- /dev/null +++ b/.github/issue_template/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Discord Community + url: https://discord.com/invite/Xn9msqQZan + about: Find community support through our Discord server. + - name: Github Duscussions + url: https://github.com/orgs/sp-tarkov/discussions + about: Please duscuss the project on the Github Duscussions board. diff --git a/.github/workflows/build-trigger.yaml b/.github/workflows/build-trigger.yaml new file mode 100644 index 00000000..a16892cb --- /dev/null +++ b/.github/workflows/build-trigger.yaml @@ -0,0 +1,22 @@ +name: Trigger Main Build Pipeline + +on: + push: + tags: + - "*" + +jobs: + trigger-main-build: + runs-on: ubuntu-latest + steps: + - name: Trigger Build Workflow + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.BUILD_REPO_ACCESS_TOKEN }} + repository: sp-tarkov/build + event-type: build-trigger + client-payload: | + { + "repository": "${{ github.repository }}", + "tag": "${{ github.ref_name }}" + } diff --git a/.gitea/workflows/clear-itemdb-cache.yaml b/.github/workflows/clear-itemdb-cache.yaml similarity index 92% rename from .gitea/workflows/clear-itemdb-cache.yaml rename to .github/workflows/clear-itemdb-cache.yaml index 8783caa3..5d385bce 100644 --- a/.gitea/workflows/clear-itemdb-cache.yaml +++ b/.github/workflows/clear-itemdb-cache.yaml @@ -8,7 +8,8 @@ jobs: clear-cache: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - id: filter uses: dorny/paths-filter@v3.0.2 with: @@ -16,6 +17,7 @@ jobs: filters: | database: - 'project/assets/database/**' + - name: Send Refresh Request if: steps.filter.outputs.database == 'true' run: curl --max-time 30 https://db.sp-tarkov.com/api/refresh diff --git a/.github/workflows/run-lint.yaml b/.github/workflows/run-lint.yaml new file mode 100644 index 00000000..2e0bb905 --- /dev/null +++ b/.github/workflows/run-lint.yaml @@ -0,0 +1,29 @@ +name: Run Code Linter + +on: + push: + branches: ["*"] + pull_request: + branches: ["*"] + +jobs: + biome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + + - uses: actions/setup-node@v4 + with: + node-version-file: "project/.nvmrc" + cache: "npm" + cache-dependency-path: "project/package.json" + + - name: Install NPM Dependencies + run: npm install + working-directory: ./project + + - name: Run Linter + run: npm run lint + working-directory: ./project diff --git a/.github/workflows/run-test.yaml b/.github/workflows/run-test.yaml new file mode 100644 index 00000000..8134ff75 --- /dev/null +++ b/.github/workflows/run-test.yaml @@ -0,0 +1,29 @@ +name: Run Tests + +on: + push: + branches: ["*"] + pull_request: + branches: ["*"] + +jobs: + vitest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + + - uses: actions/setup-node@v4 + with: + node-version-file: "project/.nvmrc" + cache: "npm" + cache-dependency-path: "project/package.json" + + - name: Install NPM Dependencies + run: npm install + working-directory: ./project + + - name: Run Tests + run: npm run test + working-directory: ./project