Skip to content

Commit

Permalink
chore: some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed Jul 10, 2024
1 parent 2bba2b8 commit a32dc17
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 430 deletions.
96 changes: 56 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,65 @@
name: Build CI

on: [push, pull_request]
on:
workflow_dispatch:
push:
tags:
- "*.*.*"
pull_request:
branches:
- main
release:
types:
- created

jobs:
linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: install packages
run: sudo apt-get install g++-multilib cmake
- name: cmake
run: mkdir build && cd build && cmake ..
- name: make
run: cd build && make -j4
- name: cpack
run: cd build && cpack
- name: create releases directory
run: mkdir releases
- name: move release package
run: cd build && mv cpack/*.tar.gz ../releases/samp-node-linux.tar.gz
- uses: actions/upload-artifact@v1
with:
name: linux-build-artifact.tar.gz
path: releases/samp-node-linux.tar.gz

- uses: actions/checkout@v4
with:
submodules: "true"
- name: install packages
run: sudo apt-get install g++-multilib cmake
- name: cmake
run: mkdir build && cd build && cmake ..
- name: make
run: cd build && make -j4
- name: cpack
run: cd build && cpack
- name: create releases directory
run: mkdir releases
- name: move release package
run: cd build && mv cpack/*.tar.gz ../releases/samp-node-linux.tar.gz
- name: Upload to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: releases/samp-node-linux.tar.gz

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: cmake
run: mkdir build && cd build && cmake .. -A Win32
- name: build
run: cd build && cmake --build . --config Release
- name: cpack
shell: powershell
run: $env:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;$env:PATH"; cd build; cpack
- name: create releases directory
run: mkdir releases
- name: move release package
run: cd build && mv cpack/*.zip ../releases/samp-node-windows.zip
- uses: actions/upload-artifact@v1
with:
name: windows-build-artifact.zip
path: releases/samp-node-windows.zip
- uses: actions/checkout@v4
with:
submodules: "true"
- name: cmake
run: mkdir build && cd build && cmake .. -A Win32
- name: build
run: cd build && cmake --build . --config Release
- name: cpack
shell: powershell
run: $env:PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;$env:PATH"; cd build; cpack
- name: create releases directory
run: mkdir releases
- name: move release package
run: cd build && mv cpack/*.zip ../releases/samp-node-windows.zip
- name: Upload to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: releases/samp-node-windows.zip
64 changes: 0 additions & 64 deletions .github/workflows/release.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ build/
.vs/
Release/*.*
Debug/*.*
test/*
dependencies/
releases/

!test/samp.json
releases/
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.0)
# -

if (NOT PLUGIN_VERSION)
set(PLUGIN_VERSION "0.2.0")
set(PLUGIN_VERSION "2.3.1")
endif()

project(samp-node VERSION ${PLUGIN_VERSION})
Expand Down
21 changes: 0 additions & 21 deletions Dockerfile.run

This file was deleted.

42 changes: 8 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
# samp-node
samp-node is a SA-MP plugin that allows you to run Node.js, meaning you can code in JS/TS instead of pawn.

---------
Forked from [`samp-node`](https://github.com/AmyrAhmady/samp-node)

Todo:
- [ ] Add samp constant values (eg: INVALID_PLAYER_ID, MAX_TEXT_DRAWS, and etc...)
###### Changes in this fork


## Download
You can always find latest builds [here](https://github.com/AmyrAhmady/samp-node/actions?query=workflow%3A%22Build+CI%22)\
But if you are looking for a stable version (or using sampctl), please visit [here](https://github.com/AmyrAhmady/samp-node/wiki/Installation)


## Node version
Currently samp-node uses Node.js v16.


## Tips
You should transpile your JS into commonjs to avoid issues. \
It's recommended you use TypeScript and setup a tsconfig that extends [@tsconfig/node16](https://www.npmjs.com/package/@tsconfig/node16).


## Type definitions for TypeScript
If you're using TypeScript then take a look at this repoistory: https://github.com/samp-dev/node \
Instructions can be found there on how to install and use them. \
*Special thanks to [pkfln (peek)](https://github.com/pkfln).*


## Credits
- [Damo](https://github.com/damopewpew) for his [samp.js project](https://github.com/damopewpew/samp.js). 80% of native caller code is from that project, cause I didn't want to do all the args processing by myself when there's already something useful out there!
- [Hual](https://github.com/Hual/) for some v8 tips he gave me
- [Graber](https://github.com/AGraber) for a few suggestions and helpful advices
- [pkfln (peek)](https://github.com/pkfln) for fixing and adding some samp callbacks/events in samp-node, and making [@sa-mp/node](https://github.com/samp-dev/node)
- [polygxn](https://github.com/polygxn) for his changes in README.md which don't exist anymore
- [JustMichael (ADRFranklin)](https://github.com/ADRFranklin) for his contributions, including fixes, features, and any others he's going to do in future
- [Alexander Plutalov (plutalov)](https://github.com/plutalov) for fixing long time crash issues and not having context running properly
- [iAmir (Amyr Aahmady)](https://github.com/AmyrAhmady) that's me.
- Used to work with [infernus](https://github.com/dockfries/infernus).
- Update node.js to v16.20.2.
- Only `entry_file` is used, `resource` config are removed.
- Updated workflows.
- Building based on `ubuntu-latest` means you may need a higher version of glibc.
- Removed `samp.fire` to avoid crashes.
16 changes: 4 additions & 12 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: "2"
tasks:
#
# BUILDING
Expand All @@ -15,23 +15,15 @@ tasks:

build:linux:
cmds:
- mkdir -p releases/
- mkdir -p releases/
- docker build -f Dockerfile -t amyrahmady/samp-node-build-linux . --build-arg PLUGIN_VERSION={{ .PLUGIN_VERSION }}
- docker run -v=$(pwd)/test:/work/test -v=$(pwd)/releases:/work/releases amyrahmady/samp-node-build-linux

build:windows:
dir: build
cmds:
cmds:
- mkdir -p ../releases
- rm -rf *
- cmake .. -DPLUGIN_VERSION={{ .PLUGIN_VERSION }} -A Win32
- cmake .. -DPLUGIN_VERSION={{ .PLUGIN_VERSION }} -A Win32
- cmake --build . --config Release
- cpack && mv cpack/*.zip ../releases

#
# TESTING
#
test:
cmds:
- sampctl package ensure && sampctl package build
- cd test && sampctl server run
2 changes: 1 addition & 1 deletion Taskvars.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PLUGIN_VERSION: 0.1.0
PLUGIN_VERSION: 2.3.1
14 changes: 0 additions & 14 deletions docker-compose.yml

This file was deleted.

17 changes: 0 additions & 17 deletions docker/sampctl-install.sh

This file was deleted.

Loading

0 comments on commit a32dc17

Please sign in to comment.