From af83f05d4faaa1f6fa8ffe3e8803f0be3de519e8 Mon Sep 17 00:00:00 2001 From: Refringe Date: Fri, 22 Nov 2024 18:22:37 -0500 Subject: [PATCH] Updates Actions - Removes build trigger (to be replaced now that cross-repo actions are available) - Updates .gitea folder to .github --- .gitea/workflows/build-trigger.yaml | 35 ----------- .gitea/workflows/run-lint.yaml | 59 ------------------- .../workflows/clear-itemdb-cache.yaml | 0 .github/workflows/run-lint.yaml | 59 +++++++++++++++++++ {.gitea => .github}/workflows/run-test.yaml | 7 ++- 5 files changed, 63 insertions(+), 97 deletions(-) delete mode 100644 .gitea/workflows/build-trigger.yaml delete mode 100644 .gitea/workflows/run-lint.yaml rename {.gitea => .github}/workflows/clear-itemdb-cache.yaml (100%) create mode 100644 .github/workflows/run-lint.yaml rename {.gitea => .github}/workflows/run-test.yaml (94%) diff --git a/.gitea/workflows/build-trigger.yaml b/.gitea/workflows/build-trigger.yaml deleted file mode 100644 index 007e514c7..000000000 --- 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 c831d8e2a..000000000 --- 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/clear-itemdb-cache.yaml b/.github/workflows/clear-itemdb-cache.yaml similarity index 100% rename from .gitea/workflows/clear-itemdb-cache.yaml rename to .github/workflows/clear-itemdb-cache.yaml diff --git a/.github/workflows/run-lint.yaml b/.github/workflows/run-lint.yaml new file mode 100644 index 000000000..58a084424 --- /dev/null +++ b/.github/workflows/run-lint.yaml @@ -0,0 +1,59 @@ +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/.github/workflows/run-test.yaml similarity index 94% rename from .gitea/workflows/run-test.yaml rename to .github/workflows/run-test.yaml index 38a5338f1..16c967636 100644 --- a/.gitea/workflows/run-test.yaml +++ b/.github/workflows/run-test.yaml @@ -2,14 +2,15 @@ name: Run Tests on: push: - branches: '*' + branches: ["*"] pull_request: - branches: '*' + 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 + 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: