forked from TBD54566975/tbd-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (103 loc) · 3.77 KB
/
tests.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Tests
on:
push:
branches:
- main
pull_request:
permissions: read-all
jobs:
all:
name: Find all examples
runs-on: ubuntu-latest
outputs:
languages: ${{ steps.build-matrix.outputs.languages }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: discover all examples
id: build-matrix
run: node .github/generate-test-steps.js >> "$GITHUB_OUTPUT"
javascript:
name: JavaScript / ${{ matrix.example.name }}
needs: all
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.all.outputs.languages).javascript }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.example.misc.node-version || '20.4.0' }}
- name: test setup
run: ${{ matrix.example.tests.pre }}
working-directory: ${{ matrix.example.directory }}
if: matrix.example.tests.pre != null
- name: test
run: ${{ matrix.example.tests.command }}
working-directory: ${{ matrix.example.directory }}
kotlin:
name: Kotlin / ${{ matrix.example.name }}
needs: all
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.all.outputs.languages).kotlin }}
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 # v3.2.1
- name: test setup
run: ${{ matrix.example.tests.pre }}
working-directory: ${{ matrix.example.directory }}
if: matrix.example.test.pre != null
- name: test in android emulator
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2.31.0
with:
api-level: 29
script: ${{ matrix.example.tests.command }}
working-directory: ${{ matrix.example.directory }}
automerge:
name: Automerge Dependabot PRs
runs-on: ubuntu-latest
needs: [javascript, kotlin]
if: github.event.pull_request.user.login == 'dependabot[bot]'
permissions:
pull-requests: write
issues: write
repository-projects: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve and merge
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: |
set -ex
gh pr review --approve "${{github.event.pull_request.html_url}}"
gh pr merge --auto --rebase "${{github.event.pull_request.html_url}}"
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}