Skip to content

Commit

Permalink
ci: updated github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Oct 7, 2024
1 parent 8fea48a commit 72b1507
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 41 deletions.
54 changes: 17 additions & 37 deletions .github/workflows/locale-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,33 @@ jobs:
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Label PR and enforce base branch
- name: Enforce base branch
uses: actions/github-script@v7
with:
script: |
// console.warn('This is bugged and doesn\'t work, skip this step for now!');
// process.exit(0);
// Add the 'translation' label
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['translation']
});
console.log(JSON.stringify(context.payload.pull_request));
const { repo, owner } = context.repo;
// Get the pull request
const pull_number = context.payload.pull_request.number;
const pull_request = await github.rest.pulls.get({
owner,
repo,
pull_number
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
// Check if the base branch is 'main' or 'master'
if (pull_request.data.base.ref === 'main' || pull_request.data.base.ref === 'master') {
// Change the base branch to 'develop'
await github.rest.pulls.update({
owner,
repo,
pull_number,
base: 'develop'
});
console.error('Pull request is targeting the main branch. Please target the develop branch instead.');
process.exit(1);
}
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22

- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Run locale:check
id: locale-check
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js 20
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: Download all modules
run: npm ci
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Tests for Workspaces

on:
push:
branches:
- master
pull_request:
branches:
- "**"

jobs:
run-tests:
name: "Run Unit Testing"
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22

- name: Download all modules
run: npm ci

- name: Run Tests
env:
CI: true
run: npm run test --workspaces
4 changes: 4 additions & 0 deletions core/extras/testEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ vi.stubEnv('TERM', 'xterm-256color');
vi.stubEnv('FORCE_COLOR', '3');
vi.stubEnv('TXADMIN_DEV_SRC_PATH', path.join(process.cwd(), '..'));
vi.stubEnv('TXADMIN_DEV_VITE_URL', 'http://localhost:40122');
if (process.env.CI) {
const citizenRoot = path.join(process.cwd(), 'alpine/opt/cfx-server/');
vi.stubEnv('TXADMIN_DEV_FXSERVER_PATH', citizenRoot);
}


// Stubbing globals
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Legend:
- [x] buffer fxserver lrstream for 5 seconds before stripping colors
- [x] fix(core): a `EMFILE: too many open files` error on windows will cause the `admins.json` to reset
- [ref](/core/components/AdminVault/index.js#L289)
- [!] check cicd stuff on testing repo before release
- [x] check cicd stuff on testing repo before release
- [?] add `.yarn.installed` to the dist? even in dev
- [?] check netid uint16 overflow
- right now the `mutex#netid` is being calculated on [logger](/core/components/Logger/handlers/server.js#L148)
Expand Down
1 change: 1 addition & 0 deletions nui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"No tests for this workspace. Skipping...\"",
"build": "vite build --mode production",
"dev": "vite build --watch --mode development",
"browser": "vite dev --port 40121 --strictPort --mode devNuiBrowser",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "rimraf dist tmp_core_tsc && npm run build -w nui && npm run build -w panel && npm run build -w core && npm run license:distfile",
"prepare": "husky",
"test": "bash ./scripts/test_build.sh",
"test": "npm run test --workspaces",
"typecheck": "npm run typecheck --workspaces",
"locale:rebase": "node scripts/locale-utils.js rebase",
"locale:check": "node scripts/locale-utils.js check --color",
Expand Down
1 change: 1 addition & 0 deletions shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "The shared package contains stuff used in more than one package, no build step required.",
"main": "index.js",
"scripts": {
"test": "echo \"No tests for this workspace. Skipping...\"",
"typecheck": "tsc -p tsconfig.json --noEmit",
"license:report": "npx license-report > ../.reports/license/shared.html"
},
Expand Down

0 comments on commit 72b1507

Please sign in to comment.