Changed Discord Notify once more #12
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: Auto Test Election creation and Voting system | |
on: push | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:15.2 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_DB: wd-todo-test | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Performs a clean installation of all dependencies in the `package.json` file | |
# For more information, see https://docs.npmjs.com/cli/ci.html | |
- name: Install dependencies | |
run: npm ci | |
- name: Run unit tests | |
run: npm run test:node | |
- name: Run the app | |
id: run-app | |
run: | | |
npm install | |
npx sequelize-cli db:drop | |
npx sequelize-cli db:create | |
npx sequelize-cli db:migrate | |
PORT=3000 npm start & | |
sleep 5 | |
- name: Run integration tests | |
run: | | |
npm install cypress cypress-json-results | |
npx cypress run | |
build_deploy: | |
needs: run-tests | |
name: 'Deploy' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to production | |
uses: johnbeynon/[email protected] | |
with: | |
service-id: ${{ secrets.RENDER_SERVICE_ID }} | |
api-key: ${{ secrets.RENDER_API_KEY }} | |
notify: | |
needs: [run-tests, build_deploy] | |
if: ${{ always() }} | |
name: Discord Notification | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Discord notification | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
embed-title: New Commit Status - ${{ job.status }} | |
embed-url: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | |
content: "A new commit is pushed to the application Online Voting Platform" | |
embed-author-name: ${{ github.event.head_commit.author.name }} | |
embed-color: 65280 |