Create UserGuide.md for 2C #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: # Usually called from deploy | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
checks: write # for coverallsapp/github-action to create new checks | |
contents: read # for actions/checkout to fetch code | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
TEST_ENV: 'production' | |
services: | |
redis: | |
image: 'redis:7.2.4' | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Enable memory overcommit | |
run: | | |
sudo sysctl -w vm.overcommit_memory=1 # Added the -w flag to write the setting immediately | |
sudo sysctl -a | grep vm.overcommit_memory | |
docker logs $(docker ps -q -f ancestor=redis:7.2.4) | grep "Memory overcommit" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
continue-on-error: true # Add this line to ignore errors | |
- run: cp install/package.json package.json | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: NPM Install | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: Setup for Redis | |
env: | |
SETUP: >- | |
{ | |
"url": "http://127.0.0.1:4567/forum", | |
"secret": "abcdef", | |
"admin:username": "admin", | |
"admin:email": "test@example.org", | |
"admin:password": "hAN3Eg8W", | |
"admin:password:confirm": "hAN3Eg8W", | |
"database": "redis", | |
"redis:host": "127.0.0.1", | |
"redis:port": 6379, | |
"redis:password": "", | |
"redis:database": 0 | |
} | |
CI: >- | |
{ | |
"host": "127.0.0.1", | |
"database": 1, | |
"port": 6379 | |
} | |
run: | | |
node app --setup="${SETUP}" --ci="${CI}" | |
- name: Run ESLint | |
run: npm run lint | |
- name: Node tests | |
run: npm test | |
- name: Extract coverage info | |
run: npm run coverage | |
- name: Test coverage | |
uses: coverallsapp/github-action@v2 |