-
Notifications
You must be signed in to change notification settings - Fork 12
69 lines (65 loc) · 2.62 KB
/
ci_entry.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
68
69
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
name: CI-Entry
on:
push:
branches:
- main
# Since this workflow is triggered by pull requests,
# we cannot use AWS credential in this workflow. Instead, we trigger
# another workflow to run the rest CI jobs on AWS batch.
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
entry:
if: github.repository == 'awslabs/ratex'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Checkout all branches and history.
- name: Check whether to skip rest tests
# If the PR only changes docs or docker file, no need to run other tests.
id: check_skip
continue-on-error: true
run: |
bash ./scripts/lint/git-skip-testing.sh
SKIP_CI=$(bash ./scripts/lint/git-skip-testing.sh)
echo "::set-output name=skip_ci::${SKIP_CI}"
- name: Save common job info
# Initialize the artifact and whether to skip CI.
run: |
mkdir job_info
echo "Skip CI? ${{ steps.check_skip.outputs.skip_ci }}"
echo "${{ steps.check_skip.outputs.skip_ci }}" > job_info/skip.txt
echo "ci" > job_info/trigger.txt
- name: Save push event job info
# Dump the job information for running CI with a new commit on main branch.
if: ${{ github.event_name == 'push' }}
run: |
echo "Ref: ${{ github.ref }}"
echo "Repo: ${{ github.repository }}"
echo "${{ github.ref }}" > job_info/ref.txt
echo "${{ github.repository }}" > job_info/repo.txt
- name: Save pull request event job info
# Dump the job information for running CI with a pull request.
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
run: |
echo "Ref: ${{ github.event.pull_request.head.ref }}"
echo "FullName: ${{ github.event.pull_request.head.repo.full_name }}"
echo "Number: ${{ github.event.number }}"
echo "HeadSHA: ${{ github.event.pull_request.head.sha }}"
echo "${{ github.event.pull_request.head.ref }}" > job_info/ref.txt
echo "${{ github.event.pull_request.head.repo.full_name }}" > job_info/repo.txt
echo "${{ github.event.number }}" > job_info/pr.txt
echo "${{ github.event.pull_request.head.sha }}" > job_info/sha.txt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: job_info
retention-days: 3