mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-12 15:50:42 -05:00
GitHub Workflow Migration
* Updates Actions - Updates .gitea folder to .github - Updates the workflows to use GH actions where available. - New build trigger workflow
This commit is contained in:
parent
8e8b97ac26
commit
c74d244dda
@ -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
|
@ -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
|
@ -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
|
22
.github/workflows/build-trigger.yaml
vendored
Normal file
22
.github/workflows/build-trigger.yaml
vendored
Normal file
@ -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 }}"
|
||||
}
|
@ -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
|
29
.github/workflows/run-lint.yaml
vendored
Normal file
29
.github/workflows/run-lint.yaml
vendored
Normal file
@ -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
|
29
.github/workflows/run-test.yaml
vendored
Normal file
29
.github/workflows/run-test.yaml
vendored
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user