Daily Multi-OS Job #70
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: Daily Multi-OS Job | |
on: | |
schedule: | |
- cron: '0 2,8,14,20 * * *' # Runs at 2 AM, 8 AM, 2 PM, and 8 PM UTC every day | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-20.04, macos-13, macos-12] # missing: windows-latest | |
fail-fast: false # Allow other jobs to continue if one fails | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.4' | |
cache: 'yarn' | |
- name: Health check versions | |
run: | | |
node -v | |
yarn -v | |
- name: Install NodeJS dependencies | |
run: yarn | |
- name: Start "Protofy" | |
run: node .github/scripts/start.js | |
- name: Run Global tests | |
run: yarn test:global | |
- name: Save result | |
if: always() | |
run: node .github/scripts/save_result.js ${{ matrix.os }} ${{ job.status }} ${{ runner.temp }} | |
- name: Upload result # upload saved result as artifact to be consumed at notify job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: result-${{ matrix.os }} | |
path: ${{ runner.temp }}/result.txt | |
notify: | |
runs-on: ubuntu-latest | |
needs: build | |
if: always() # This ensures that the notification job runs whether the build job succeeds or fails | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: Combine results | |
run: | | |
for result_dir in result-*; do | |
if [ -d "$result_dir" ]; then | |
cat "$result_dir/result.txt" >> combined_results.txt | |
fi | |
done | |
echo "Combined results result:" | |
echo "RESULTS<<EOF" >> $GITHUB_ENV | |
cat combined_results.txt >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Daily build Report | |
uses: rjstone/discord-webhook-notify@v1 | |
env: | |
RESULTS: ${{ env.RESULTS }} | |
with: | |
severity: info | |
color: '#a600e0' | |
avatarUrl: https://raw.githubusercontent.com/Protofy-xyz/Protofy/assets/protofito_purple.png | |
description: | | |
Daily OS Build Report 👀 | |
${{ env.RESULTS }} | |
footer: Daily report. | |
text: 🚨 Check daily report! 🚨 | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} |