mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-11-05 20:22:25 +08:00
75 lines
1.9 KiB
YAML
75 lines
1.9 KiB
YAML
name: Test Your PR
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build:
|
|
name: Generate ROA
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
generate_roa: ${{ steps.generate_roa.outputs.base64 }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
repository: NeoCloud/NeoNetwork-ROA
|
|
path: generated
|
|
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.x
|
|
architecture: x64
|
|
|
|
- run: pip install -r scripts/requirements.txt
|
|
|
|
- run: |
|
|
success=true
|
|
|
|
scripts/generate-roa.sh 2> >(tee ~/buildjob.log >&2) || success=false
|
|
|
|
echo -n "base64=" >> $GITHUB_OUTPUT
|
|
base64 -w0 ~/buildjob.log >> $GITHUB_OUTPUT
|
|
${success}
|
|
shell: bash
|
|
id: generate_roa
|
|
|
|
- run: git -C generated diff README.md
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: generated
|
|
path: generated
|
|
|
|
comment_success:
|
|
needs: [build]
|
|
runs-on: ubuntu-20.04
|
|
if: ${{ always() && contains(needs.build.result, 'success') }}
|
|
steps:
|
|
- uses: thollander/actions-comment-pull-request@v2
|
|
with:
|
|
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
|
|
message: |
|
|
Congratulations! Your pull request passed the check.
|
|
|
|
comment_failure:
|
|
needs: [build]
|
|
runs-on: ubuntu-20.04
|
|
if: ${{ always() && contains(needs.build.result, 'failure') }}
|
|
steps:
|
|
- shell: bash
|
|
run: |
|
|
echo ${{needs.build.outputs.generate_roa}} | base64 -d |tail > /tmp/buildjob_tail.log || echo 'internal error' > /tmp/buildjob_tail.log
|
|
|
|
- uses: thollander/actions-comment-pull-request@v2
|
|
with:
|
|
token: ${{ secrets.COMMENT_GITHUB_TOKEN }}
|
|
filePath: /tmp/buildjob_tail.log
|
|
|
|
- run: false
|