From 428f2a95a666c8e1789ac00d4c4c699dcdd2e89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 12:47:03 -0500 Subject: [PATCH] added runner script --- .gitea/workflows/node-ci.yaml | 110 ++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .gitea/workflows/node-ci.yaml diff --git a/.gitea/workflows/node-ci.yaml b/.gitea/workflows/node-ci.yaml new file mode 100644 index 0000000..4c94957 --- /dev/null +++ b/.gitea/workflows/node-ci.yaml @@ -0,0 +1,110 @@ +name: Node-CI + + +on: + push: + branches: [main] + paths-ignore: + - '**.md' + - 'docs/**' + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Lint failed + + test: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test -- --passWithNoTests + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Test failed + + build: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Generate Prisma + run: npm run prisma:generate + + - name: Run build + run: npm run build + + - name: Create and deploy Container image + if: ${{ success() }} + run: | + echo "VERSION_NUMBER=$(date +'%y%m%d.%H%M%S')" >> $GITHUB_ENV + docker build -t git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} . + docker tag git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} git.targo.ca/targo/targo_backend_staging:latest + docker login -u ${{ secrets.CI_USER }} -p ${{ secrets.CI_PASSWORD }} git.targo.ca + docker push git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} + docker push git.targo.ca/targo/targo_backend_staging:latest + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Build failed