11# #
2- # @parent github workflow
3- # @desc test build
4- # @author Aetherinox
5- # @url https://github.com/Aetherinox
2+ # @type github workflow
3+ # @author Aetherinox
4+ # @url https://github.com/Aetherinox
5+ # @usage run npm tests
6+ #
7+ # @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
8+ # secrets.SELF_TOKEN_CL self github personal access token (classic)
9+ # secrets.NPM_TOKEN self npmjs access token
10+ # secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
11+ # secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
12+ # secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
13+ # secrets.CODECOV_TOKEN codecov upload token for nodejs projects
14+ # secrets.MAXMIND_GELITE_TOKEN maxmind API token
15+ # secrets.CF_ACCOUNT_ID cloudflare account id
16+ # secrets.CF_ACCOUNT_TOKEN cloudflare account token
17+ # secrets.ORG_TOKEN org github personal access token (fine-grained)
18+ # secrets.ORG_TOKEN_CL org github personal access token (classic)
19+ # secrets.ORG_DOCKERHUB_TOKEN org dockerhub secret
20+ # secrets.ORG_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
21+ # secrets.BOT_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
22+ # secrets.BOT_GPG_KEY_B64 bot gpg private key (binary) converted to base64
23+ # secrets.BOT_GPG_PASSPHRASE bot gpg private key passphrase
24+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_RELEASES discord webhook to report release notifications from github to discord
25+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_WORKFLOWS discord webhook to report workflow notifications from github to discord
26+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_UPDATES discord webhook to report activity notifications from github to discord
27+ #
28+ # @local these workflows can be tested locally through the use of `act`
29+ # https://github.com/nektos/act
30+ # Extract act to folder
31+ # Add system env var with path to act.exe
32+ # Run the commands:
33+ # git pull https://github.com/username/repo
34+ # act -W .github/workflows/npm-tests.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
35+ # act -W .github/workflows/npm-tests.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
636# #
737
8- run-name : " 🌑 NPM › Tests"
9- name : " ☁️ NPM › Tests"
38+ run-name : ' 🌑 NPM › Tests'
39+ name : ' ☁️ NPM › Tests'
1040
1141# #
1242# triggers
@@ -15,20 +45,18 @@ name: "☁️ NPM › Tests"
1545on :
1646 push :
1747 branches :
18- - " main"
48+ - ' main'
1949 pull_request :
2050 branches :
21- - " main"
51+ - ' main'
2252
2353# #
2454# environment variables
2555# #
2656
2757env :
2858 FOLDER_DIST : ' dist'
29- BOT_NAME_1 : AdminServ
30- BOT_NAME_2 : AdminServX
31- BOT_NAME_3 : EuropaServ
59+ BOT_NAME : BinaryServ
3260 BOT_NAME_DEPENDABOT : dependabot[bot]
3361 GITHUB_TOKEN : ${{ secrets.SELF_TOKEN_CL }}
3462 OWNER : ${{ github.repository_owner }}
@@ -51,17 +79,15 @@ jobs:
5179 # [ CI ] Start
5280 # #
5381
54- - name : " ✅ Start"
55- id : task_npmtest_start
82+ - name : ' ✅ Start'
5683 run : |
5784 echo "Starting nightly reset"
5885
5986 # #
6087 # [ CI ] Checkout
6188 # #
6289
63- - name : " ☑️ Checkout"
64- id : task_npmtest_checkout
90+ - name : ' ☑️ Checkout'
6591 uses : actions/checkout@v4
6692 with :
6793 fetch-depth : 0
7096 # [ CI ] Node Setup
7197 # #
7298
73- - name : " ⚙️ Setup › Node"
74- id : task_npmtest_node_setup
99+ - name : ' ⚙️ Setup › Node'
75100 uses : actions/setup-node@v4
76101 with :
77102 node-version : ' 20.x'
@@ -82,19 +107,18 @@ jobs:
82107 # [ CI ] Node - Install
83108 # #
84109
85- - name : " 📦 NPM › Install"
86- id : task_npmtest_npm_install
110+ - name : ' 📦 NPM › Install'
87111 run : |
88112 npm install
89113 env :
90- NODE_AUTH_TOKEN : ${{ secrets.SELF_TOKEN_CL }}
114+ NODE_AUTH_TOKEN : ${{ secrets.SELF_TOKEN }}
91115
92116 # #
93117 # Package Version > Set
94118 # Get version from package.json VERSION value
95119 # #
96120
97- - name : " 👁️🗨️ Package Version › Get"
121+ - name : ' 👁️🗨️ Package Version › Get'
98122 id : task_npmtest_package_version
99123 run : |
100124 VER=$(cat package.json | jq -r '.version')
@@ -104,25 +128,22 @@ jobs:
104128 # Package Version > Print (Debug)
105129 # #
106130
107- - name : " 👁️🗨️ Package Version › Print"
108- id : task_npmtest_package_version_debug
131+ - name : ' 👁️🗨️ Package Version › Print'
109132 run : |
110133 echo "VERSION: ${{ steps.task_initialize_package_version.outputs.PACKAGE_VERSION }}"
111134
112135 # #
113136 # [ CI ] Lint
114137 # #
115138
116- - name : " 📦 NPM › Lint"
117- id : task_npmtest_npm_lint
139+ - name : ' 📦 NPM › Lint'
118140 run : npm run lint
119141
120142 # #
121143 # Release > Execute npm generate so that a uuid and guid can be created
122144 # #
123145
124- - name : " 🪪 Generate IDs"
125- id : task_npmtest_npm_env_generate
146+ - name : ' 🪪 Generate IDs'
126147 run : |
127148 npm run root:generate
128149
@@ -131,7 +152,7 @@ jobs:
131152 # Get guid and uuid from env variable generated by npm
132153 # #
133154
134- - name : " 🪪 .ENV › Get"
155+ - name : ' 🪪 .ENV › Get'
135156 id : task_npmtest_dotenv_get
136157 uses : falti/dotenv-action@v1
137158
@@ -140,8 +161,7 @@ jobs:
140161 # Show guid and uuid from env variable generated by npm
141162 # #
142163
143- - name : " 🪪 .ENV › Read"
144- id : task_npmtest_dotenv_print
164+ - name : ' 🪪 .ENV › Read'
145165 run : |
146166 echo "GUID: ${{ steps.task_npmtest_dotenv_get.outputs.GUID }}"
147167 echo "UUID: ${{ steps.task_npmtest_dotenv_get.outputs.UUID }}"
@@ -150,31 +170,28 @@ jobs:
150170 # [ CI ] Test
151171 # #
152172
153- - name : " 📦 NPM › Test"
154- id : task_npmtest_npm_test
173+ - name : ' 📦 NPM › Test'
155174 run : npm run test
156175 env :
157- GITHUB_TOKEN : ${{ env.SELF_TOKEN_CL }}
176+ GITHUB_TOKEN : ${{ env.GITHUB_TOKEN }}
158177
159178 # #
160179 # [ CI ] Create Github Deployment
161180 # #
162181
163- - name : " 🔨 Create GitHub deployment"
164- id : task_npmtest_gh_deployment_create
182+ - name : ' 🔨 Create GitHub deployment'
165183 uses : chrnorm/deployment-action@v2
166184 with :
167- token : ${{ env.SELF_TOKEN_CL }}
185+ token : ${{ env.GITHUB_TOKEN }}
168186 environment : test
169187 initial-status : success
170188
171189 # #
172190 # [ CI ] Delete Github Deployment
173191 # #
174192
175- - name : " 🔨 Delete GitHub deployment"
176- id : task_npmtest_gh_deployment_delete
193+ - name : ' 🔨 Delete GitHub deployment'
177194 uses : ./
178195 with :
179- token : ${{ env.SELF_TOKEN_CL }}
196+ token : ${{ env.GITHUB_TOKEN }}
180197 environment : test
0 commit comments