forked from saber-notes/saber
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.17 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
name: Run tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
env:
# MAINTENANCE_CHECKS_ENABLED is overridden later
MAINTENANCE_CHECKS_ENABLED: true
jobs:
run-tests:
name: Run Flutter tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Remove unneeded files
run: |
rm -rf assets_raw
rm -rf submodules
- name: Install Flutter dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev libsecret-1-dev libjsoncpp-dev ghostscript
- name: Setup cache
uses: actions/cache@v3
with:
path: |
build
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }}
restore-keys: |
${{ runner.OS }}-saber-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- run: flutter pub get
- name: Prepare environment for tests
run: |
if [ "$GITHUB_REPOSITORY" = "saber-notes/saber" ] && [ "$GITHUB_REF_NAME" = "main" ]; then
MAINTENANCE_CHECKS_ENABLED=true
else
MAINTENANCE_CHECKS_ENABLED=false
fi
echo "MAINTENANCE_CHECKS_ENABLED=$MAINTENANCE_CHECKS_ENABLED" >> $GITHUB_ENV
- name: Run tests
id: tests
run: |
flutter test \
--coverage \
--dart-define=maintenanceChecksEnabled="${{ env.MAINTENANCE_CHECKS_ENABLED }}"
- name: Upload to Codecov
if: success()
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
- name: Ensure test failures directory exists
if: failure()
run: mkdir -p test/failures
- name: Upload test failures
if: failure()
uses: actions/upload-artifact@v3
with:
name: Saber-test-failures
path: test/failures