|
8 | 8 | branches-ignore: |
9 | 9 | - gh-pages # deployment target branch (this workflow should not exist on that branch anyway) |
10 | 10 | - v** # such branch names conflict with tags |
| 11 | + workflow_dispatch: |
11 | 12 |
|
12 | 13 | jobs: |
13 | 14 | gitlab-ci: |
14 | | - if: github.repository == 'pulp-platform/axi' # do not run this job on forks (because Gitlab CI |
15 | | - runs-on: ubuntu-latest # will not trigger on forks) |
16 | | - timeout-minutes: 190 |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 310 |
17 | 17 | steps: |
18 | | - - name: Checkout |
19 | | - uses: actions/checkout@v2 |
| 18 | + - name: Check Gitlab CI |
| 19 | + uses: pulp-platform/pulp-actions/gitlab-ci@v2 |
| 20 | + # Skip on forks or pull requests from forks due to missing secrets. |
| 21 | + if: github.repository == 'pulp-platform/axi' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) |
20 | 22 | with: |
21 | | - persist-credentials: false |
22 | | - # Checkout pull request HEAD commit instead of merge commit, because CI runs against HEAD |
23 | | - # commit. |
24 | | - ref: ${{ github.event.pull_request.head.sha }} |
25 | | - |
26 | | - - name: Wait for synchronization (every 5 minutes) |
27 | | - run: | |
28 | | - while [ $(($(date -d "+1 minute" +%-M) % 5)) -ne 0 ]; do |
29 | | - # "+1 minute" because if the current minute is divisible by 5, we likely already missed |
30 | | - # the synchronization. |
31 | | - sleep 10 |
32 | | - done |
33 | | - sleep 90 # the minute above plus 30 seconds to leave some time for the synchronization |
34 | | - shell: bash |
35 | | - |
36 | | - - name: Obtain CI result |
37 | | - run: | |
38 | | - if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then |
39 | | - BRANCH_NAME="$GITHUB_HEAD_REF" |
40 | | - elif [ "$GITHUB_EVENT_NAME" == "push" ]; then |
41 | | - if echo $GITHUB_REF | grep -qE '^refs/heads'; then |
42 | | - BRANCH_NAME="$(echo $GITHUB_REF | cut -d '/' -f3-)" |
43 | | - else |
44 | | - echo "Error: Could not derive branch name from ref '$GITHUB_REF'!" |
45 | | - exit 1 |
46 | | - fi |
47 | | - else |
48 | | - echo "Error: Unsupported event: '$GITHUB_EVENT_NAME'!" |
49 | | - exit 1 |
50 | | - fi |
51 | | - while true; do |
52 | | - resp="$(curl --fail --silent --show-error \ |
53 | | - https://akurth.net/usrv/ig/shields/pipeline/akurth/axi/$BRANCH_NAME)" |
54 | | - if [ $? -ne 0 ]; then |
55 | | - echo "Error: Failed to obtain CI status!" |
56 | | - exit 1 |
57 | | - fi |
58 | | - status="$(echo $resp | jq -r .message)" |
59 | | - if [ "$status" == "passing" ]; then |
60 | | - sha="$(echo $resp | jq -r .sha)" |
61 | | - if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then |
62 | | - github_sha="$(cat "$GITHUB_EVENT_PATH" | jq -r .pull_request.head.sha)" |
63 | | - else |
64 | | - github_sha="$GITHUB_SHA" |
65 | | - fi |
66 | | - if [ "$sha" == "$github_sha" ]; then |
67 | | - echo "CI passed." |
68 | | - exit 0 |
69 | | - else |
70 | | - echo "Error: CI passed, but on a different SHA: '$sha'!" |
71 | | - exit 1 |
72 | | - fi |
73 | | - elif [ "$status" == "running" ]; then |
74 | | - echo "CI is running, waiting .." |
75 | | - else |
76 | | - echo "Error: Unknown or failing status: '$status'!" |
77 | | - exit 1 |
78 | | - fi |
79 | | - sleep 10 |
80 | | - done |
81 | | - shell: bash |
| 23 | + domain: iis-git.ee.ethz.ch |
| 24 | + repo: github-mirror/axi |
| 25 | + token: ${{ secrets.GITLAB_TOKEN }} |
| 26 | + poll-count: 1800 |
0 commit comments