-
Notifications
You must be signed in to change notification settings - Fork 5
62 lines (52 loc) · 1.75 KB
/
ci.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
name: CI
on:
- push
- pull_request
jobs:
detect_languages:
name: Select tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Find all languages
run: |
ls -d */ | egrep -v '^_' | tr -d / | sort > all_langs
cp all_langs langs_to_test
- name: Find changed languages
if: github.event_name == 'pull_request' || github.ref != 'refs/heads/master'
run: |
before_ref=${{ github.event.pull_request.base.sha || 'origin/master' }}
git diff --name-only $before_ref ${{ github.sha }} > changed_files
if ! egrep -q '^(_test/.*|test|docker_test)$' changed_files; then
git diff --name-only $before_ref ${{ github.sha }} |
cut -f1 -d'/' |
sort |
uniq |
comm -12 - all_langs > langs_to_test
fi
- name: Set job output
id: set-job-output
run: |
jq -R -s -c 'split("\n") | map(select(length > 0))' < langs_to_test > langs_to_test.json
echo "Languages to test: $(cat langs_to_test.json)"
echo "::set-output name=languages::$(cat langs_to_test.json)"
outputs:
languages: ${{ steps.set-job-output.outputs.languages }}
test:
name: Test
runs-on: ubuntu-latest
needs: detect_languages
if: ${{ needs.detect_languages.outputs.languages != '[]' }}
strategy:
fail-fast: false
matrix:
lang: ${{ fromJson(needs.detect_languages.outputs.languages) }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run tests
run: ./docker_test '${{ matrix.lang }}'
timeout-minutes: 10