diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..20b0362 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main", "CI_CD" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [ 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: | + echo "TZ=UTC" >> .env + echo "PORT=8000" >> .env + echo "HOST=localhost" >> .env + echo "LOG_LEVEL=info" >> .env + echo "NODE_ENV=development" >> .env + echo "SESSION_DRIVER=cookie" >> .env + echo "MONGO_URI=mongodb://localhost:27017/citium" >> .env + echo "JWT_SECRET=$(openssl rand -base64 32)" >> .env + - run: npm ci + - run: node ace generate:key + - run: node ace test