Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest #155

Merged
merged 8 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 67 additions & 54 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.0.0
# Created with package:mono_repo v6.6.1
name: Dart CI
on:
push:
Expand All @@ -11,126 +11,135 @@ defaults:
shell: bash
env:
PUB_ENVIRONMENT: bot.github
permissions: read-all

jobs:
job_001:
name: "analyze; PKG: edgehead; `dart analyze --fatal-infos --fatal-warnings .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead;commands:analyze"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead;commands:analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: edgehead_pub_upgrade
name: edgehead; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: edgehead
run: dart pub upgrade
- name: "edgehead; dart analyze --fatal-infos --fatal-warnings ."
run: dart analyze --fatal-infos --fatal-warnings .
if: "always() && steps.edgehead_pub_upgrade.conclusion == 'success'"
working-directory: edgehead
run: dart analyze --fatal-infos --fatal-warnings .
job_002:
name: "analyze; PKG: egamebook_builder; `dart analyze --fatal-infos --fatal-warnings .`"
name: "analyze; PKG: edgehead; `dart format --output=none --set-exit-if-changed .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder;commands:analyze"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead;commands:format"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
- id: egamebook_builder_pub_upgrade
name: egamebook_builder; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: egamebook_builder
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: edgehead_pub_upgrade
name: edgehead; dart pub upgrade
run: dart pub upgrade
- name: "egamebook_builder; dart analyze --fatal-infos --fatal-warnings ."
if: "always() && steps.egamebook_builder_pub_upgrade.conclusion == 'success'"
working-directory: egamebook_builder
run: dart analyze --fatal-infos --fatal-warnings .
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: edgehead
- name: "edgehead; dart format --output=none --set-exit-if-changed ."
run: "dart format --output=none --set-exit-if-changed ."
if: "always() && steps.edgehead_pub_upgrade.conclusion == 'success'"
working-directory: edgehead
job_003:
name: "analyze; PKG: edgehead; `dart format --output=none --set-exit-if-changed .`"
name: "analyze; PKG: egamebook_builder; `dart format --output=none --set-exit-if-changed .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead;commands:format"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder;commands:format"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
- id: edgehead_pub_upgrade
name: edgehead; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: edgehead
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: egamebook_builder_pub_upgrade
name: egamebook_builder; dart pub upgrade
run: dart pub upgrade
- name: "edgehead; dart format --output=none --set-exit-if-changed ."
if: "always() && steps.edgehead_pub_upgrade.conclusion == 'success'"
working-directory: edgehead
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: egamebook_builder
- name: "egamebook_builder; dart format --output=none --set-exit-if-changed ."
run: "dart format --output=none --set-exit-if-changed ."
if: "always() && steps.egamebook_builder_pub_upgrade.conclusion == 'success'"
working-directory: egamebook_builder
job_004:
name: "analyze; PKG: egamebook_builder; `dart format --output=none --set-exit-if-changed .`"
name: "analyze; PKG: egamebook_builder; `dart analyze --fatal-warnings .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder;commands:format"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: egamebook_builder_pub_upgrade
name: egamebook_builder; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: egamebook_builder
run: dart pub upgrade
- name: "egamebook_builder; dart format --output=none --set-exit-if-changed ."
- name: "egamebook_builder; dart analyze --fatal-warnings ."
run: dart analyze --fatal-warnings .
if: "always() && steps.egamebook_builder_pub_upgrade.conclusion == 'success'"
working-directory: egamebook_builder
run: "dart format --output=none --set-exit-if-changed ."
job_005:
name: "unit_test; PKG: edgehead; `pub run build_runner build --delete-conflicting-outputs && dart test`"
name: "unit_test; PKG: edgehead; `dart run build_runner build --delete-conflicting-outputs && dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:edgehead;commands:command"
Expand All @@ -139,20 +148,22 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: edgehead_pub_upgrade
name: edgehead; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: edgehead
run: dart pub upgrade
- name: "edgehead; pub run build_runner build --delete-conflicting-outputs && dart test"
- name: "edgehead; dart run build_runner build --delete-conflicting-outputs && dart test"
run: "dart run build_runner build --delete-conflicting-outputs && dart test"
if: "always() && steps.edgehead_pub_upgrade.conclusion == 'success'"
working-directory: edgehead
run: "pub run build_runner build --delete-conflicting-outputs && dart test"
needs:
- job_001
- job_002
Expand All @@ -163,7 +174,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v2.1.7
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:egamebook_builder;commands:test"
Expand All @@ -172,20 +183,22 @@ jobs:
os:ubuntu-latest;pub-cache-hosted;sdk:stable
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
- name: Setup Dart SDK
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
- id: checkout
uses: actions/[email protected]
name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- id: egamebook_builder_pub_upgrade
name: egamebook_builder; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: egamebook_builder
run: dart pub upgrade
- name: egamebook_builder; dart test
run: dart test
if: "always() && steps.egamebook_builder_pub_upgrade.conclusion == 'success'"
working-directory: egamebook_builder
run: dart test
needs:
- job_001
- job_002
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To play the IFCOMP 2017 entry called _Insignificant Little Vermin_,
Most development happens inside the subfolders of this monorepo.
But for CI, you'll need to use the Dart `mono_repo` package:

pub global activate mono_repo
dart pub global activate mono_repo

This installs the `mono_repo` command line tool.

Expand Down
28 changes: 14 additions & 14 deletions edgehead/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Here are some additional "philosophical" pillars:
4. Go to the `edgehead` sub-project (`cd edgehead`)
5. Install Dart packages (`pub get`)

Now you can try running tests (`pub run test`) or play the game on the command
Now you can try running tests (`dart run test`) or play the game on the command
line (`dart --enable-asserts bin/play.dart --log`).

### Playtesting
Expand Down Expand Up @@ -153,13 +153,13 @@ to Trello cards by dragging and dropping them.

Run the following when developing:

pub run build_runner watch --delete-conflicting-outputs
dart run build_runner watch --delete-conflicting-outputs

This will make sure that generated files (`*.g.dart`) are regenerated when
needed.

Most writing is in text files in the `assets/text/` directory.
When the `pub run build_runner watch` watcher is running, it will, among other
When the `dart run build_runner watch` watcher is running, it will, among other
things, watch for changes of the text files. It will compile the texts into the
`lib/writers_input.compiled.dart` file, which is then used by the game itself.

Expand All @@ -173,16 +173,16 @@ This is often caused by an earlier problem (for example, hitting save while
your `egb.txt` files are in some in-between state), which makes the source
generator build the files in the wrong order. The remedy is to run:

pub run build_runner clean
dart run build_runner clean

After this, run the `pub run build_runner watch` command again and all should
After this, run the `dart run build_runner watch` command again and all should
be good.

Most behavior and game-related code is in the other files in `lib/`. You
might want to start with `lib/edgehead_lib.dart`.

To test, run `pub run test`, and to include long-running fuzzy tests,
run `pub run --enable-asserts test --run-skipped`.
To test, run `dart run test`, and to include long-running fuzzy tests,
run `dart run --enable-asserts test --run-skipped`.

#### Debug play-testing

Expand All @@ -206,15 +206,15 @@ variables in the IDE.

### Testing

Run `pub run test` or setup your IDE for continuous unit testing.
Run `dart run test` or setup your IDE for continuous unit testing.

Also included are long-running tests that are skipped by default. These
tests are "fuzzy" -- meaning that they will try to play the game randomly until
completion or error.

Run all the tests, including the long-running ones, using this command:

pub run --enable-asserts test --run-skipped
dart run --enable-asserts test --run-skipped

The `--enable-asserts` flag tells Dart to run assertions and generally be more
fail-fast. It also makes the code run a few percent slower.
Expand All @@ -225,7 +225,7 @@ If you're feeling especially paranoid (e.g. before a production release),
you can run the fuzzy test in an infinite loop with the following Unix command:

```bash
while pub run --enable-asserts test -t long-running --run-skipped; do :; done
while dart run --enable-asserts test -t long-running --run-skipped; do :; done
```

The command will run forever unless a test fails or until you press `Ctrl-C`.
Expand All @@ -235,17 +235,17 @@ test suite several times in a row. Like this:

```bash
for n in {1..10}; do echo "=== Run number ${n} ==="; \
pub run --enable-asserts test --run-skipped; done
dart run --enable-asserts test --run-skipped; done
```

#### Sharded testing

To run tests in parallel, you can use sharding:

```bash
$ pub run --enable-asserts test --total-shards 3 --shard-index 0 --run-skipped
$ pub run --enable-asserts test --total-shards 3 --shard-index 1 --run-skipped
$ pub run --enable-asserts test --total-shards 3 --shard-index 2 --run-skipped
$ dart run --enable-asserts test --total-shards 3 --shard-index 0 --run-skipped
$ dart run --enable-asserts test --total-shards 3 --shard-index 1 --run-skipped
$ dart run --enable-asserts test --total-shards 3 --shard-index 2 --run-skipped
```

### Playing on the command line
Expand Down
4 changes: 2 additions & 2 deletions edgehead/benchmark/full.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class FullRunBenchmark extends _BenchmarkBase {
/// of the speed of the game (especially the AI).
class _BenchmarkBase {
final String name;
final _ScoreEmitter emitter;
_ScoreEmitter get emitter => const _PrintEmitter();

// Empty constructor.
const _BenchmarkBase(this.name, {this.emitter = const _PrintEmitter()});
const _BenchmarkBase(this.name);

// The benchmark code.
// This function is not used, if both [warmup] and [exercise] are overwritten.
Expand Down
2 changes: 1 addition & 1 deletion edgehead/lib/director/environmental/karl_heard.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of edgehead_director;
part of '../../edgehead_director.dart';

final _karlHeardFirstTime = Rule(_id++, 1, true, (ApplicabilityContext c) {
// Only heard from within the Pyramid.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of edgehead_director;
part of '../../edgehead_director.dart';

final _dargLeavesCrowdsource = Rule(_id++, 3, true, (ApplicabilityContext c) {
return !c.hasHappened(evKilledDarg) &&
Expand Down
2 changes: 1 addition & 1 deletion edgehead/lib/director/situational/leroy_quits.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of edgehead_director;
part of '../../edgehead_director.dart';

final _leroyQuitsAfterGoblinCamp =
Rule(_id++, 2, true, (ApplicabilityContext c) {
Expand Down
2 changes: 1 addition & 1 deletion edgehead/lib/director/situational/player_hurts.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of edgehead_director;
part of '../../edgehead_director.dart';

final _playerHurt = Rule(_id++, 1, false, (ApplicabilityContext c) {
return c.isHurt(playerId);
Expand Down
2 changes: 1 addition & 1 deletion edgehead/lib/director/temporal/caravan_arrival.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of edgehead_director;
part of '../../edgehead_director.dart';

/// Caravan Arrival.
///
Expand Down
Loading
Loading