add notification #32
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: CI Workflow | |
on: [push] | |
jobs: | |
integration-test: | |
runs-on: ubuntu-latest | |
outputs: | |
test_status: ${{ job.status }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Build and Run Bootnode Node | |
run: | | |
echo "Test Build and Run Bootnode Node" > es-node-it-bootnode.log& | |
exit 1 | |
- name: Upload Blobs | |
run: | | |
mkdir integration | |
echo "Test Upload Blobs" > ./integration/upload.log | |
- name: Test | |
run: | | |
echo "Test ES-Node" > es-node-it.log& | |
echo "Test ItServer" > ./cmd/integration-test-server/itserver.log | |
upload: | |
if: ${{ always() }} | |
needs: integration-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload Logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: result-log | |
path: | | |
deploy.log | |
es-node-it-bootnode.log | |
./integration/upload.log | |
es-node-it.log | |
./cmd/integration-test-server/itserver.log | |
notification: | |
if: ${{ always() }} | |
needs: [upload, integration-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send notification email | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: smtp.gmail.com # 使用 Gmail SMTP | |
server_port: 465 | |
username: ${{ secrets.SMTP_USERNAME }} | |
password: ${{ secrets.SMTP_PASSWORD }} | |
subject: ${{ github.repository }} GitHub Actions ${{ github.workflow }} Run ${{ needs.integration-test.outputs.test_status }} - ${{ github.sha }} | |
to: [email protected],[email protected],[email protected] | |
from: ${{ secrets.SMTP_USERNAME }} # 发件人邮箱 | |
body: | | |
"GitHub Action job completed with status: ${{ needs.integration-test.outputs.test_status }}! Check the details at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |