-
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (147 loc) · 4.76 KB
/
test.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
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call:
defaults:
run:
shell: bash
env:
PUB_ENVIRONMENT: bot.github
permissions: read-all
jobs:
analyze:
name: "Analyze"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v4
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart;commands:codegen-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@v4
- id: install
name: Install dependencies
run: dart pub get
- name: Check the formatting of one or more Dart files
run: dart format lib test --output=none --set-exit-if-changed .
- name: Analyze the project's Dart code
run: dart analyze lib test --fatal-infos
test:
name: "Test"
needs: analyze
runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: chrome
- platform: vm
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v4
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart;commands:codegen-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- id: checkout
name: Checkout repository
uses: actions/checkout@v4
- id: install
name: Install dependencies
run: dart pub get
- name: Run the project's tests in Chrome
if: ${{ matrix.platform == 'chrome' }}
run: dart test --platform chrome
- name: Install coverage dependencies
if: ${{ matrix.platform == 'vm' }}
run: |
dart pub global activate coverage
dart pub global activate remove_from_coverage
- name: Collect and report coverage
if: ${{ matrix.platform == 'vm' }}
run: |
dart pub global run coverage:test_with_coverage
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
- name: Upload coverage to Codecov
if: ${{ matrix.platform == 'vm' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: techouse/qs
file: ./coverage/lcov.info
verbose: true
- name: Upload coverage to Codacy
if: ${{ matrix.platform == 'vm' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov.info
ensure_compatibility:
name: "Ensure compatibility with qs"
needs: analyze
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v4
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart;commands:codegen-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:qs_dart
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- id: checkout
name: Checkout repository
uses: actions/checkout@v4
- id: install_dart_dependencies
name: Install Dart dependencies
run: dart pub get
- id: install_node_dependencies
name: Install Node dependencies
working-directory: test/comparison
run: npm install
- name: Run a comparison test between qs_dart and qs for JavaScript
working-directory: test/comparison
continue-on-error: true
run: |
set -e
node_output=$(node qs.js)
dart_output=$(dart run qs.dart)
if [ "$node_output" == "$dart_output" ]; then
echo "The outputs are identical."
else
echo "The outputs are different."
exit 1
fi