Adds chatGPT bundle and create prompt mask #985
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: Protofy CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 20.4.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.4.x' | |
cache: 'yarn' | |
- name: Health check versions | |
run: | | |
node -v | |
yarn -v | |
- name: Install NodeJS dependencies | |
run: yarn | |
- name: Start project | |
run: | | |
echo 'Started project' | |
yarn dev > /dev/null & | |
- name: Healthcheck services start | |
run: node .github/scripts/healthcheck-start.js | |
- name: Run tests | |
run: | | |
set -o pipefail | |
sudo yarn test:all | tee ${{ runner.temp }}/test_output.txt | |
- name: Get test report | |
if: always() # executed always even if job fails | |
run: node .github/scripts/retrieveTestsReport.js ${{ runner.temp }}/test_output.txt > ${{ runner.temp }}/testsReport.txt | |
- name: Show output report | |
run: cat ${{ runner.temp }}/testsReport.txt | |
- name: Upload result # upload saved result as artifact to be consumed at notify job | |
if: always() # executed always even if job fails | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports | |
path: ${{ runner.temp }}/testsReport.txt | |
notify: | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ always() && github.event_name != 'pull_request' }} # This job runs only if the trigger is not a pull request | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 20.4.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.4.x' | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: '[healthcheck] "test" job status and testsReprot content' | |
run: | | |
echo "${{ needs.test.result }}" | |
cat reports/testsReport.txt | |
- name: Save report to environment variable | |
run: | | |
echo "TEST_REPORT<<EOF" >> $GITHUB_ENV | |
cat reports/testsReport.txt | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Get shorten GitHub sha | |
run: echo "GITHUB_SHORT_SHA=$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV | |
- name: Get skipped status to retrieve color and save it to environment variable | |
run: | | |
if grep -q "🚧 PASS" reports/testsReport.txt; then | |
echo "SKIPPED=True" >> $GITHUB_ENV | |
echo "TEST_COLOR=#ffa600" >> $GITHUB_ENV | |
echo "TEST_AVATAR_COLOR=orange" >> $GITHUB_ENV | |
else | |
echo "SKIPPED=False" >> $GITHUB_ENV | |
echo "TEST_COLOR=#00e065" >> $GITHUB_ENV | |
echo "TEST_AVATAR_COLOR=green" >> $GITHUB_ENV | |
fi | |
- name: Test Success | |
uses: rjstone/discord-webhook-notify@v1 | |
if: needs.test.result == 'success' | |
with: | |
severity: info | |
details: Test Succeeded! | |
username: ${{ github.event.pusher.name }} | |
color: ${{ env.TEST_COLOR }} | |
avatarUrl: https://raw.githubusercontent.com/Protofy-xyz/Protofy/assets/protofito_${{ env.TEST_AVATAR_COLOR}}.png | |
description: | | |
${{ env.TEST_REPORT }} | |
- **Event:** push | |
- **Repo:** Protofy-xyz/Protofy at ${{ github.ref }} | |
- **Author:** ${{ github.event.head_commit.author.name }} | |
- **Committer [pusher]:** ${{ github.event.head_commit.committer.name }} [${{ github.event.pusher.name }}] | |
- **Commit [[${{ env.GITHUB_SHORT_SHA }}](${{ github.event.head_commit.url }})]:** ${{ github.event.head_commit.message }} | |
footer: "Workflow: ${{ github.workflow }}" | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: Test Failure | |
uses: rjstone/discord-webhook-notify@v1 | |
if: needs.test.result == 'failure' | |
with: | |
severity: error | |
details: Test Failed! | |
username: ${{ github.event.pusher.name }} | |
color: '#f13932' | |
avatarUrl: https://raw.githubusercontent.com/Protofy-xyz/Protofy/assets/protofito_red.png | |
description: | | |
${{ env.TEST_REPORT }} | |
- **Event:** push | |
- **Repo:** Protofy-xyz/Protofy at ${{ github.ref }} | |
- **Author:** ${{ github.event.head_commit.author.name }} | |
- **Committer [pusher]:** ${{ github.event.head_commit.committer.name }} [${{ github.event.pusher.name }}] | |
- **Commit [[${{ env.GITHUB_SHORT_SHA }}](${{ github.event.head_commit.url }})]:** ${{ github.event.head_commit.message }} | |
footer: "Workflow: ${{ github.workflow }}" | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: Test Cancelled | |
uses: rjstone/discord-webhook-notify@v1 | |
if: needs.test.result == 'cancelled' | |
with: | |
severity: warn | |
details: Job Cancelled! | |
username: ${{ github.event.pusher.name }} | |
color: '#ffa600' | |
avatarUrl: https://raw.githubusercontent.com/Protofy-xyz/Protofy/assets/protofito_orange.png | |
description: | | |
- **Event:** push | |
- **Repo:** Protofy-xyz/Protofy at ${{ github.ref }} | |
- **Author:** ${{ github.event.head_commit.author.name }} | |
- **Committer [pusher]:** ${{ github.event.head_commit.committer.name }} [${{ github.event.pusher.name }}] | |
- **Commit [[${{ env.GITHUB_SHORT_SHA }}](${{ github.event.head_commit.url }})]:** ${{ github.event.head_commit.message }} | |
footer: "Workflow: ${{ github.workflow }}" | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} |