generated from SanJSp/lets_git_exercise_en
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 2.2 KB
/
issue5_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: issue5_test
on:
push:
branches:
- feature5_image
pull_request:
types: [ opened ]
jobs:
build:
runs-on: ubuntu-latest
if: github.head_ref == 'feature5_image' || github.ref == 'refs/heads/feature5_image'
strategy:
matrix:
python-version: [ '3.x' ]
name: Python ${{ matrix.python-version }} sample
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: python tests/Aufgabe5_test.py > test-output.txt
- run: echo ::set-output name=result::$(grep "Yes" test-output.txt | wc -l)
id: test
shell: bash
- run: echo ::set-output name=comment::$(< ./fail.md)
id: fail
shell: bash
working-directory: ./.github/COMMENT_TEMPLATES
- run: cat ./.github/COMMENT_TEMPLATES/lastSuccess.md > comment.txt
shell: bash
- run: node ./.github/misc/answers.js 5 >> comment.txt
if: steps.test.outputs.result == '1'
- run: echo ::set-output name=comment::$(< comment.txt)
id: success
shell: bash
- name: PR Comment Fail
uses: Janealter/branch-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: ${{ steps.fail.outputs.comment }}
branch: feature5_image
if: steps.test.outputs.result != '1'
- name: PR Comment Success
uses: Janealter/branch-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: ${{ steps.success.outputs.comment }}
branch: feature5_image
if: steps.test.outputs.result == '1'
- run: exit 1
if: steps.test.outputs.result != '1'