-
Notifications
You must be signed in to change notification settings - Fork 18
73 lines (65 loc) · 2.41 KB
/
Copy pathci_test.yml
File metadata and controls
73 lines (65 loc) · 2.41 KB
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
70
71
72
73
# Testing workflow of the CI
name: 'CI Github TEST'
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
repository_dispatch:
types: [run-ci]
# disable all the permission for the workflow
permissions: {}
# Cancel existing runs
concurrency:
group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
get_information:
name: Get Information
# information is: commit message for PR
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'testCI') || github.event_name == 'reposit'
outputs:
COMMIT_MSG: ${{ steps.get_commit_message.outputs.COMMIT_MSG }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 3
ref: ${{ github.event.pull_request.head.sha || github.ref }}
# require to get the previous commit for getting their messages
# in a PR the last commit is the commit merge with main
- name: Get commit message
id: get_commit_message
# return an empty message when the event is not from a PR
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "COMMIT_MSG<<$EOF" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" == "pull_request_target" ]; then
echo "COMMIT_MSG=$(git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }})" # use for debugging
echo "$(git log -1 --pretty=%B ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
else
echo "$EOF" >> $GITHUB_OUTPUT
fi
tests:
name: tests
needs: [get_information]
uses: ./.github/workflows/call_test_package.yml
with:
skip_test: ${{ contains(needs.get_information.outputs.COMMIT_MSG, '[skip tests]') }}
tests_minimal:
name: tests minimal
needs: [get_information]
uses: ./.github/workflows/call_test_minimal.yml
with:
skip_test: ${{ contains(needs.get_information.outputs.COMMIT_MSG, '[skip tests]') }}
# tests_publish:
# name: tests_publish
# needs: [tests]
# if: |
# ${{ github.event.pull_request.draft == false
# || contains(needs.get_information.outputs.COMMIT_MSG, '[doc ')
# }}
# permissions:
# pull-requests: write
# secrets: inherit
# uses: ./.github/workflows/call_publish_result.yml