Skip to content
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
12 changes: 12 additions & 0 deletions .github/deploy/rtx/dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"args": [
"--dev",
"--map-server",
"map-gen-2:5000",
"--seed-repository-url",
"s3:map-rando-seeds",
"--video-storage-url",
"https://map-rando-videos.b-cdn.net",
"--test-map-server"
]
}
35 changes: 35 additions & 0 deletions .github/scripts/create_image_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import json
import os
from pathlib import Path


def main():
config_root = Path(".github/deploy")
deploy_configs = {
path.relative_to(config_root).with_suffix("").as_posix(): json.loads(path.read_text())
for path in sorted(config_root.glob("*/*.json"))
}
if not deploy_configs:
raise ValueError("No deployment configurations found in .github/deploy/*/*.json")
metadata = {
"digest": os.environ["IMAGE_DIGEST"],
"commit": os.environ["GITHUB_SHA"],
"run_id": int(os.environ["GITHUB_RUN_ID"]),
"run_attempt": int(os.environ["GITHUB_RUN_ATTEMPT"]),
"deploy_configs": deploy_configs,
}
Path("image-metadata.json").write_text(json.dumps(metadata, indent=2) + "\n")
repository_url = f"{os.environ['GITHUB_SERVER_URL']}/{os.environ['GITHUB_REPOSITORY']}"
summary = (
"### Published image\n\n"
f"- Image: `docker.io/bkerby/map-rando@{metadata['digest']}`\n"
f"- Commit: [{metadata['commit']}]({repository_url}/commit/{metadata['commit']})\n"
f"- Build: [run {metadata['run_id']}, attempt {metadata['run_attempt']}]"
f"({repository_url}/actions/runs/{metadata['run_id']}/attempts/{metadata['run_attempt']})\n"
)
with Path(os.environ["GITHUB_STEP_SUMMARY"]).open("a") as summary_file:
summary_file.write(summary)


if __name__ == "__main__":
main()
19 changes: 4 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
env:
DOCKER_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }}
steps:
-
name: Check out deployment configurations
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -91,21 +94,7 @@ jobs:
name: Write image metadata
env:
IMAGE_DIGEST: ${{ steps.build.outputs.digest }}
run: |
jq -n \
--arg digest "$IMAGE_DIGEST" \
--arg commit "$GITHUB_SHA" \
--argjson run_id "$GITHUB_RUN_ID" \
--argjson run_attempt "$GITHUB_RUN_ATTEMPT" \
'{digest: $digest, commit: $commit, run_id: $run_id, run_attempt: $run_attempt}' \
> image-metadata.json

printf '### Published image\n\n- Image: `docker.io/bkerby/map-rando@%s`\n- Commit: [%s](%s/%s/commit/%s)\n- Build: [run %s, attempt %s](%s/%s/actions/runs/%s/attempts/%s)\n' \
"$IMAGE_DIGEST" \
"$GITHUB_SHA" "$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_SHA" \
"$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" \
"$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" \
>> "$GITHUB_STEP_SUMMARY"
run: python3 .github/scripts/create_image_metadata.py
-
name: Upload image metadata
uses: actions/upload-artifact@v7
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
const fs = require('node:fs/promises');
const run = context.payload.workflow_run;
const metadata = JSON.parse(await fs.readFile('image-metadata/image-metadata.json', 'utf8'));
const deployConfig = metadata.deploy_configs['rtx/dev'];
if (deployConfig === undefined) {
throw new Error('Build metadata is missing .github/deploy/rtx/dev.json');
}
// Rerunning this publisher creates a new request, including to retry a failed rollout.
const response = await github.rest.repos.createDeployment({
...context.repo,
Expand All @@ -48,6 +52,7 @@ jobs:
description: `CI run ${run.id}, attempt ${run.run_attempt}`,
payload: {
digest: metadata.digest,
deploy_config: deployConfig,
build_run_id: run.id,
build_run_attempt: run.run_attempt
}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
const fs = require('node:fs/promises');
const run = context.payload.workflow_run;
const metadata = JSON.parse(await fs.readFile('image-metadata/image-metadata.json', 'utf8'));
const deployConfig = metadata.deploy_configs['rtx/experimental'];
if (deployConfig === undefined) {
throw new Error('Build metadata is missing .github/deploy/rtx/experimental.json');
}
// Rerunning this publisher creates a new request, including to retry a failed rollout.
const response = await github.rest.repos.createDeployment({
...context.repo,
Expand All @@ -48,6 +52,7 @@ jobs:
description: `Experimental CI run ${run.id}, attempt ${run.run_attempt}`,
payload: {
digest: metadata.digest,
deploy_config: deployConfig,
build_run_id: run.id,
build_run_attempt: run.run_attempt
}
Expand Down
2 changes: 2 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4904,7 +4904,7 @@
0.21052631578947367
]
},
"reward_missing_connect_utility": 1.0,
"reward_missing_connect_utility": 2.0,
"reward_area_x": 10.0,
"reward_area_y": 10.0,
"target_area_rooms": [
Expand Down
3 changes: 2 additions & 1 deletion rust/data/presets/full-settings/Default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4820,7 +4820,8 @@
0.7
]
},
"reward_missing_connect_utility": 1.0,
"reward_missing_connect_utility": 2.0,
"max_return_distance": 13.0,
"reward_area_x": 10.0,
"reward_area_y": 10.0,
"target_area_rooms": [
Expand Down
2 changes: 1 addition & 1 deletion rust/data/presets/full-settings/Mentor Tournament.json
Original file line number Diff line number Diff line change
Expand Up @@ -4904,7 +4904,7 @@
0.21052631578947367
]
},
"reward_missing_connect_utility": 1.0,
"reward_missing_connect_utility": 2.0,
"reward_area_x": 10.0,
"reward_area_y": 10.0,
"target_area_rooms": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4816,7 +4816,7 @@
0.21052631578947367
]
},
"reward_missing_connect_utility": 1.0,
"reward_missing_connect_utility": 2.0,
"reward_area_x": 10.0,
"reward_area_y": 10.0,
"target_area_rooms": [
Expand Down
2 changes: 1 addition & 1 deletion rust/maprando-game/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3107,7 +3107,7 @@ impl GameData {
.notable_map
.unwrap()
.get(&notable_name)
.context(format!("Undefined notable: {}", &notable_name))?;
.context(format!("Undefined notable: {}", notable_name))?;
return Ok(Requirement::Notable(notable_idx));
} else if key == "heatFramesWithEnergyDrops" {
let frames = self.parse_numeric(&value["frames"]).unwrap_or_else(|e| {
Expand Down
Loading
Loading