Skip to content

Commit 05bf9f0

Browse files
authored
Merge pull request #1021 from UC-Davis-molecular-computing/dev
Dev
2 parents 82b085b + 95f05ca commit 05bf9f0

File tree

243 files changed

+8238
-7374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+8238
-7374
lines changed

.github/workflows/dart.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Dart CI
22

3-
on:
3+
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, ready_for_review]
5+
types: [ opened, synchronize, reopened, ready_for_review ]
66

77
jobs:
88
run_unit_tests:
@@ -11,27 +11,27 @@ jobs:
1111
runs-on: ubuntu-22.04
1212

1313
steps:
14-
- name: Setup Dart SDK Step 1
15-
run: sudo apt-get update
16-
- name: Setup Dart SDK Step 2
17-
run: sudo apt-get install apt-transport-https
18-
- name: Setup Dart SDK Step 3
19-
run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
20-
- name: Setup Dart SDK Step 4
21-
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
22-
- name: Setup Dart SDK Step 5
23-
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
24-
- name: Setup Dart SDK Step 6
25-
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
26-
- uses: actions/checkout@v3
27-
- name: Install dependencies
28-
run: PATH="$PATH:/usr/lib/dart/bin" pub get
29-
- name: Run tests
30-
run: PATH="$PATH:/usr/lib/dart/bin" pub run build_runner test
14+
- name: Setup Dart SDK Step 1
15+
run: sudo apt-get update
16+
- name: Setup Dart SDK Step 2
17+
run: sudo apt-get install apt-transport-https
18+
- name: Setup Dart SDK Step 3
19+
run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
20+
- name: Setup Dart SDK Step 4
21+
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
22+
- name: Setup Dart SDK Step 5
23+
run: wget -O /tmp/dart_3.5.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/3.5.4/linux_packages/dart_3.5.4-1_amd64.deb
24+
- name: Setup Dart SDK Step 6
25+
run: sudo apt install /tmp/dart_3.5.4-1_amd64.deb
26+
- uses: actions/checkout@v4
27+
- name: Install dependencies
28+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub get
29+
- name: Run tests
30+
run: PATH="$PATH:/usr/lib/dart/bin" dart run build_runner test
3131

3232
fail_if_pull_request_is_draft:
3333
if: github.event.pull_request.draft == true
3434
runs-on: ubuntu-18.04
3535
steps:
36-
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
37-
run: exit 1
36+
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
37+
run: exit 1
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Dart Formatting
22

3-
on:
3+
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, ready_for_review]
5+
types: [ opened, synchronize, reopened, ready_for_review ]
66

77
jobs:
88
check_formatting:
@@ -11,27 +11,27 @@ jobs:
1111
runs-on: ubuntu-22.04
1212

1313
steps:
14-
- name: Setup Dart SDK Step 1
15-
run: sudo apt-get update
16-
- name: Setup Dart SDK Step 2
17-
run: sudo apt-get install apt-transport-https
18-
- name: Setup Dart SDK Step 3
19-
run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
20-
- name: Setup Dart SDK Step 4
21-
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
22-
- name: Setup Dart SDK Step 5
23-
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
24-
- name: Setup Dart SDK Step 6
25-
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
26-
- uses: actions/checkout@v3
27-
- name: Install dependencies
28-
run: PATH="$PATH:/usr/lib/dart/bin" pub get
29-
- name: Verify formatting
30-
run: dart format -l 110 --output=none --set-exit-if-changed .
31-
14+
- name: Setup Dart SDK Step 1
15+
run: sudo apt-get update
16+
- name: Setup Dart SDK Step 2
17+
run: sudo apt-get install apt-transport-https
18+
- name: Setup Dart SDK Step 3
19+
run: sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
20+
- name: Setup Dart SDK Step 4
21+
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
22+
- name: Setup Dart SDK Step 5
23+
run: wget -O /tmp/dart_3.5.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/3.5.4/linux_packages/dart_3.5.4-1_amd64.deb
24+
- name: Setup Dart SDK Step 6
25+
run: sudo apt install /tmp/dart_3.5.4-1_amd64.deb
26+
- uses: actions/checkout@v4
27+
- name: Install dependencies
28+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub get
29+
- name: Verify formatting
30+
run: PATH="$PATH:/usr/lib/dart/bin" dart format -l 110 --output=none --set-exit-if-changed .
31+
3232
fail_if_pull_request_is_draft:
3333
if: github.event.pull_request.draft == true
3434
runs-on: ubuntu-18.04
3535
steps:
36-
- name: Fails in order to indicate that pull request needs to be marked as ready to review and formatting workflow needs to pass.
37-
run: exit 1
36+
- name: Fails in order to indicate that pull request needs to be marked as ready to review and formatting workflow needs to pass.
37+
run: exit 1

.github/workflows/gh-pages-dev.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
with:
2020
ref: gh-pages
2121
path: gh-pages-repo
22-
23-
22+
23+
2424

2525
- name: Setup Dart SDK Step 1
2626
run: sudo apt-get update
@@ -31,20 +31,20 @@ jobs:
3131
- name: Setup Dart SDK Step 4
3232
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
3333
- name: Setup Dart SDK Step 5
34-
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
34+
run: wget -O /tmp/dart_3.5.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/3.5.4/linux_packages/dart_3.5.4-1_amd64.deb
3535
- name: Setup Dart SDK Step 6
36-
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
36+
run: sudo apt install /tmp/dart_3.5.4-1_amd64.deb
3737

3838
- name: Install dependencies
39-
run: PATH="$PATH:/usr/lib/dart/bin" pub get
40-
39+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub get
40+
4141
- name: Install webdev
42-
run: PATH="$PATH:/usr/lib/dart/bin" pub global activate webdev
43-
42+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub global activate webdev
43+
4444

4545
- name: Build into gh-pages repo
46-
run: PATH="$PATH:/usr/lib/dart/bin" pub global run webdev build -o web:gh-pages-repo/dev
47-
46+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub global run webdev build -o web:gh-pages-repo/dev
47+
4848

4949
- name: Deploy
5050
uses: peaceiris/actions-gh-pages@v3

.github/workflows/gh-pages.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
with:
1818
ref: gh-pages
1919
path: gh-pages-repo
20-
21-
20+
21+
2222

2323
- name: Setup Dart SDK Step 1
2424
run: sudo apt-get update
@@ -29,14 +29,14 @@ jobs:
2929
- name: Setup Dart SDK Step 4
3030
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
3131
- name: Setup Dart SDK Step 5
32-
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
32+
run: wget -O /tmp/dart_3.5.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/3.5.4/linux_packages/dart_3.5.4-1_amd64.deb
3333
- name: Setup Dart SDK Step 6
34-
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
34+
run: sudo apt install /tmp/dart_3.5.4-1_amd64.deb
3535
- name: Install dependencies
36-
run: PATH="$PATH:/usr/lib/dart/bin" pub get
37-
36+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub get
37+
3838
- name: Install webdev
39-
run: PATH="$PATH:/usr/lib/dart/bin" pub global activate webdev
39+
run: PATH="$PATH:/usr/lib/dart/bin" dart pub global activate webdev
4040

4141

4242
- name: Build into gh-pages repo
@@ -45,11 +45,11 @@ jobs:
4545
run: echo "VERSION=$(cat lib/src/constants.dart | grep 'const String CURRENT_VERSION = .*' | grep -oP '\d+\.\d+\.\d+')" >> $GITHUB_ENV
4646
- name: Build into gh-pages-repo/VERSION
4747
run: |
48-
if [ "$VERSION" != "" ]; then
49-
PATH="$PATH:/usr/lib/dart/bin" pub global run webdev build -o web:gh-pages-repo/v$VERSION
50-
else
51-
echo "::warning deploying VERSION skipped because VERSION number could not be found"
52-
fi
48+
if [ "$VERSION" != "" ]; then
49+
PATH="$PATH:/usr/lib/dart/bin" pub global run webdev build -o web:gh-pages-repo/v$VERSION
50+
else
51+
echo "::warning deploying VERSION skipped because VERSION number could not be found"
52+
fi
5353
5454
- name: Deploy
5555
uses: peaceiris/actions-gh-pages@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Remove the following pattern if you wish to check in your lock file
55
# pubspec.lock
66

7+
# I used this to add `// @dart=2.9` to the top of all dart files
8+
add-line.py
9+
710
# Conventional directory for build outputs
811
build/
912

CONTRIBUTING.md

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -241,23 +241,23 @@ git checkout dev
241241

242242
### Installing Dart
243243

244-
This project requires using Dart version **2.13**, not the latest version. Click on a dropdown below for installation instructions for your operating system.
244+
This project requires using Dart version **3.5.4**, not the latest version. Click on a dropdown below for installation instructions for your operating system.
245245

246246
<!--TODO: Find a way to use code blocks with syntax highlighting inside <details>-->
247247

248248
<details><summary><strong>Windows</strong></summary>
249249
First, install <a href="https://chocolatey.org/install">Chocolatey</a> if you haven't already. If <code>choco help</code> shows a help menu for using Chocolatey, then you've set it up correctly.
250250

251-
Then, install Dart 2.13.4:
251+
Then, open a shell (cmd/Powershell) with Administrative privileges (go to Start type `cmd`, right-click on "Command Prompt", or type Powershell and right-click on "Powershell"; in both cases pick "Run as administrator") and install Dart 3.5.4:
252252

253253
<pre>
254-
choco install dart-sdk --version 2.13.4
254+
choco install dart-sdk --version 3.5.4
255255
</pre>
256256

257257
To stop Chocolatey from automatically updating Dart to the latest version, pin it:
258258

259259
<pre>
260-
choco pin --name="'dart-sdk'" --version="'2.13.4'"
260+
choco pin --name="'dart-sdk'" --version="'3.5.4'"
261261
</pre>
262262

263263
</details>
@@ -267,16 +267,16 @@ First, install <a href="https://brew.sh/">Homebrew</a> if you haven't already. I
267267

268268
It may help to run `brew tap dart-lang/dart` first.
269269

270-
Then, install Dart 2.13.4:
270+
Then, install Dart 3.5.4:
271271

272272
<pre>
273-
brew install dart@2.13.4
273+
brew install dart@3.5.4
274274
</pre>
275275

276276
To stop Homebrew from automatically updating Dart to the latest version, pin it:
277277

278278
<pre>
279-
brew pin dart@2.13.4
279+
brew pin dart@3.5.4
280280
</pre>
281281

282282
If running `dart` in a terminal now does not work, you may need to follow <a href="https://docs.brew.sh/FAQ#my-mac-apps-dont-find-homebrew-utilities">these instructions</a>.
@@ -292,17 +292,17 @@ wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dea
292292
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
293293
</pre>
294294

295-
Then, install Dart 2.13.4:
295+
Then, install Dart 3.5.4:
296296

297297
<pre>
298298
sudo apt-get update
299-
sudo apt-get install dart=2.13.4
299+
sudo apt-get install dart=3.5.4
300300
</pre>
301301

302302
To stop apt from automatically updating Dart to the latest version, hold it:
303303

304304
<pre>
305-
sudo apt-mark hold dart=2.13.4
305+
sudo apt-mark hold dart=3.5.4
306306
</pre>
307307

308308
</details>
@@ -314,15 +314,42 @@ After installing the Dart SDK, you should see a help menu when you run `dart`.
314314
Once you have installed Dart, install all the Dart dependencies (from the same directory `scadnano` into which the project was cloned by git):
315315

316316
```
317-
pub get
317+
dart pub get
318+
```
319+
320+
Try running the unit tests like this:
321+
322+
```
323+
dart run build_runner test
324+
```
325+
326+
If the above command fails, it should be run as sudo or an administrator.
327+
328+
It should report something like this after running the tests:
329+
330+
```
331+
C:\Dropbox\git\scadnano>dart run build_runner test
332+
[INFO] Generating build script completed, took 248ms
333+
[INFO] Reading cached asset graph completed, took 332ms
334+
[INFO] Checking for updates since last build completed, took 474ms
335+
[INFO] Running build completed, took 17.0s
336+
[INFO] Caching finalized dependency graph completed, took 367ms
337+
[INFO] Creating merged output dir `C:\Users\pexat\AppData\Local\Temp\build_runner_test1a56df4\` completed, took 3.0s
338+
[INFO] Writing asset manifest completed, took 18ms
339+
[INFO] Succeeded after 20.4s with 933 outputs (1003 actions)
340+
Running tests...
341+
342+
Building package executable... (4.0s)
343+
Built test:test.
344+
00:11 +491 ~2: All tests passed!
318345
```
319346

320347
### Installing `webdev`
321348

322-
This project uses an older version of the `webdev` tool, not the latest version, to build and serve the web app. Install it with:
349+
`webdev` is used to run a local server for running scadnano in your browser for testing. Install it with:
323350

324351
```
325-
pub global activate webdev 2.5.9
352+
dart pub global activate webdev
326353
```
327354

328355
Note that often a message like this appears:
@@ -350,16 +377,14 @@ server](https://dart.dev/tools/webdev#serve).
350377

351378
Sometimes it may be necessary to clean out the generated files and cache if this has an error. See the file `clean.sh`, which has this line: `dart run build_runner clean`. Also see `remove_g.sh`, which removes all `.g.dart` files from the project, which can also help to fix compilation errors.
352379

353-
If that does not work, try `dart run build_runner clean --delete-conflicting-outputs`.
380+
If that does not work, try `dart run build_runner build --delete-conflicting-outputs`, and then run `webdev serve`.
354381

355382
Running `webdev serve --release` will compile the project in production mode (instead of development mode), which is claimed to be faster in principle if you are not doing development and just want to run scadnano offline.
356383
However, in scadnano, it doesn't appear to make a big difference whether development or production mode is used.
357384
The webdev program will tell you which URL to enter in your browser; it will be something like
358385

359386
```
360-
361387
[INFO] Serving `web` on http://127.0.0.1:8080
362-
363388
```
364389

365390
Sometimes you may see an unexpected compilation error even if you haven't changed the code from a state where it was compiling okay. If you've really tried to fix an error and it doesn't seem to be due to a mistake in the code, then as a last resort, try running `./clean.sh`. This will clear out cached files and `.g.dart` files, which can sometimes become stale and need to be regenerated. If you run `./clean.sh`, and the project still does not compile, then it is a genuine syntax error that needs to be fixed.
@@ -384,12 +409,31 @@ extensions helpful for debugging and profiling.
384409

385410
### Running Tests
386411

387-
Unit tests are contained in the [test](test/) directory.
412+
Unit tests are contained in the [test](test/) directory. To run them all type `dart run build_runner test`.
413+
414+
You can also run one file at a time like this:
415+
416+
```
417+
dart run build_runner test -- test\assign_dna_unit_test.dart
418+
```
419+
420+
or even one test at a time like this:
421+
422+
```
423+
dart run build_runner test -- test\assign_dna_unit_test.dart --plain-name "Assign/remove dna test: AssignDNA"
424+
```
425+
426+
That can be useful for debugging a test using the Chrome browser devtools like this:
427+
428+
```
429+
dart run build_runner test -- test\assign_dna_unit_test.dart --plain-name "Assign/remove dna test: AssignDNA" -P debug
430+
```
431+
432+
This opens a browser and lets you set a breakpoint if you open browser dev tools (type Ctrl+Shift+I). It can be a bit hard to find the files, look here:
433+
434+
![alt text](images/location-of-scadnano-sources-unit-testing.png)
435+
388436

389-
The repository provides a test script [test.sh](test.sh), which
390-
provides common utilities for running unit tests. All unit tests
391-
can be run by `bash test.sh`. To see more options, run
392-
`bash test.sh -h`.
393437

394438
Please add unit tests whenever possible. Currently, there are unit
395439
tests for [Redux reducers](test/reducer_test.dart) and a few tests for

0 commit comments

Comments
 (0)