-
Notifications
You must be signed in to change notification settings - Fork 8
165 lines (132 loc) · 4.47 KB
/
dart.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Dart
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup flutter SDK
uses: subosito/flutter-action@v2
with:
cache: true
- name: Setup melos
run: dart pub global activate melos
- run: flutter doctor -v
- run: flutter precache
- name: melos bootstrap
run: dart pub global run melos bootstrap
- name: melos checkformat
run: dart pub global run melos run checkformat
- name: melos analyze
run: dart pub global run melos run analyze
- name: melos test
run: dart pub global run melos test
create-panda-temp-key:
name: Create temporary SSH key
runs-on: panda
concurrency: panda-temp-key
steps:
- uses: actions/checkout@v3
- name: Generate keypair
run: |
ssh-keygen -b 4096 -t rsa -f ./sshkey -q -N ""
- name: Add public key to authorized_keys
run: |
echo expiry-time='"'$(date --date=+1hour +%Y%m%d%H%M)'"' $(cat ./sshkey.pub) > ~/.ssh/authorized_keys
- name: Encrypt private key for uploading
env:
AES_KEY: ${{ secrets.AES_KEY }}
run: |
gpg \
--batch --yes \
--symmetric --cipher-algo AES256 \
--passphrase="$AES_KEY" \
--output ./sshkey.gpg \
sshkey
- name: Upload keypair
uses: actions/upload-artifact@v3
with:
name: keypair
path: |
sshkey.gpg
sshkey.pub
integration-test:
runs-on: ubuntu-latest
needs: create-panda-temp-key
concurrency: panda-temp-key
steps:
- uses: actions/checkout@v3
- name: Download keypair
uses: actions/download-artifact@v3
with:
name: keypair
path: .
- name: Decrypt private key
env:
AES_KEY: ${{ secrets.AES_KEY }}
run: |
gpg \
--batch --yes \
--decrypt \
--passphrase="$AES_KEY" \
--output ./sshkey \
./sshkey.gpg
chmod 0600 ./sshkey
- name: Setup adb forward
run: |
mkdir -p ~/.ssh
echo "[md.ardera.dev]:23 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC41DBiTm+uvaeZqUp4LcUck99c7+vIv/nS4rH4rt/rmSs5KAlJrz7TwicgDYobAdDL8Nnfyz0F2CG88uCNRea0=" >> ~/.ssh/known_hosts
ssh -vvv -N -n -o ExitOnForwardFailure=yes -o BatchMode=yes -L 127.0.0.1:5555:odroid-c4:5555 -p 23 -i ./sshkey [email protected] &
sleep 5
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: List adb devices
run: |
adb devices -l
adb connect 127.0.0.1:5555
adb devices -l
- name: Setup flutter SDK
uses: subosito/flutter-action@v2
with:
cache: true
- name: Setup melos
run: dart pub global activate melos
- run: flutter doctor -v
- run: flutter precache
- name: melos bootstrap
run: dart pub global run melos bootstrap
- name: make ODROID C4 gpio chips accessible
run: |
adb -t 2 shell chmod 0777 /dev/gpiochip0
adb -t 2 shell chmod 0777 /dev/gpiochip1
- name: run flutter_gpiod_test_app on ODROID C4
working-directory: packages/flutter_gpiod_test_app
run: flutter test -d "127.0.0.1:5555" -t odroidc4 integration_test/gpio_test.dart
delete-panda-temp-key:
name: Delete temporary SSH key
runs-on: panda
needs: integration-test
concurrency: panda-temp-key
# run even if integration-test failed
if: ${{ always() }}
steps:
- uses: actions/checkout@v3
- name: Download keypair
uses: actions/download-artifact@v3
with:
name: keypair
path: .
- name: Remove key from authorized_keys file
run: |
echo "::group::List authorized keys"
echo "::debug::$(cat ~/.ssh/authorized_keys)"
echo "::endgroup::"
grep -v "$(cat sshkey.pub)" ~/.ssh/authorized_keys | sponge ~/.ssh/authorized_keys
echo "::group::List authorized keys"
echo "::debug::$(cat ~/.ssh/authorized_keys)"
echo "::endgroup::"