Skip to content

Commit

Permalink
Merge pull request #29 from Ryex/develop
Browse files Browse the repository at this point in the history
Bump main to version 0.2.1
  • Loading branch information
Ryex authored Apr 22, 2024
2 parents ed6b120 + e18698d commit 5042337
Show file tree
Hide file tree
Showing 19 changed files with 742 additions and 406 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: delopy main
on:
push:
branches:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/devlop-deploy-netlify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: deploy preview to netlify
on:
push:
branches:
- develop
- "!main"

permissions:
contents: read
packages: read
checks: write
statuses: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: '8.15.7'
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build ic10lsp
run: |
RUST_BACKTRACE=1 cargo xtask build -p ic10lsp_wasm --release -- --
- name: Build ic10emu
run: |
RUST_BACKTRACE=1 cargo xtask build -p ic10emu_wasm --release -- --
- name: Build Page
run: |
cd www
pnpm install
pnpm build
- name: Fix permissions
run: |
chmod -c -R +rX "www/dist/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: www/dist
- name: Deploy to Netlify
uses: jsmrcaga/action-netlify-deploy@v2.0.0
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN_SECRET }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_DEPLOY_TO_PROD: true
install_command: "echo Skipping installing the dependencies"
build_command: "echo Skipping building the web files"
build_directory: www/dist
- name: Status check
uses: Sibz/github-status-action@v1.1.1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: Netlify preview
state: success
target_url: ${{ env.NETLIFY_PREVIEW_URL }}
65 changes: 65 additions & 0 deletions .github/workflows/pull_request_deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

name: netlify deploy-preview
on:
pull_request:
types: ['opened', 'edited', 'synchronize']
branches:
- develop
- "!main"

permissions:
contents: read
packages: read
checks: write
statuses: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: '8.15.7'
- name: Install rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build ic10lsp
run: |
RUST_BACKTRACE=1 cargo xtask build -p ic10lsp_wasm --release -- --
- name: Build ic10emu
run: |
RUST_BACKTRACE=1 cargo xtask build -p ic10emu_wasm --release -- --
- name: Build Page
run: |
cd www
pnpm install
pnpm build
- name: Fix permissions
run: |
chmod -c -R +rX "www/dist/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: www/dist
- name: Deploy to Netlify
uses: jsmrcaga/action-netlify-deploy@v2.0.0
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN_SECRET }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
install_command: "echo Skipping installing the dependencies"
build_command: "echo Skipping building the web files"
build_directory: www/dist
deploy_alias: ${{ env.BRANCH_NAME }}
- name: Status check
uses: Sibz/github-status-action@v1.1.1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: Netlify preview
state: success
target_url: ${{ env.NETLIFY_PREVIEW_URL }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ target/
Session.vim
*.pyc
package-lock.json

# Local Netlify folder
.netlify
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.2.1

- prevent borrow panics in VM during batch operations
- fix Maximize batch mode
- fix panic in parsing invalid numbers

## v0.2.0

### Share VM State!
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["ic10lsp_wasm", "ic10emu_wasm", "ic10emu", "xtask"]
resolver = "2"

[workspace.package]
version = "0.2.0"
version = "0.2.1"
edition = "2021"

[profile.release]
Expand Down
24 changes: 13 additions & 11 deletions ic10emu/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ fn write_repr_enum<'a, T: std::io::Write, I, P>(
.map(|s| format!("serialize = \"{s}\""))
.collect::<Vec<String>>()
.join(", ");
let deprecated_str = if variant.deprecated {
", deprecated = \"true\"".to_owned()
} else {
"".to_owned()
};
let props_str = if let Some(val) = &variant.value {
format!(", props( value = \"{val}\"{deprecated_str})")
let mut props = Vec::new();
if variant.deprecated {
props.push("deprecated = \"true\"".to_owned());
}
if let Some(val) = &variant.value {
props.push(format!("value = \"{val}\""));
}
let props_str = if !props.is_empty() {
format!(", props( {} )", props.join(", "))
} else {
"".to_owned()
};
Expand All @@ -70,15 +72,15 @@ fn write_logictypes() {
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);

let mut logictypes: Vec<(String, EnumVariant<u8>)> = Vec::new();
let mut logictypes: Vec<(String, EnumVariant<u16>)> = Vec::new();
let l_infile = Path::new("data/logictypes.txt");
let l_contents = fs::read_to_string(l_infile).unwrap();

for line in l_contents.lines().filter(|l| !l.trim().is_empty()) {
let mut it = line.splitn(3, ' ');
let name = it.next().unwrap();
let val_str = it.next().unwrap();
let val: Option<u8> = val_str.parse().ok();
let val: Option<u16> = val_str.parse().ok();
let docs = it.next();
let deprecated = docs
.map(|docs| docs.trim().to_uppercase() == "DEPRECATED")
Expand Down Expand Up @@ -172,15 +174,15 @@ fn write_enums() {
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);

let mut enums_map: Vec<(String, EnumVariant<u16>)> = Vec::new();
let mut enums_map: Vec<(String, EnumVariant<u32>)> = Vec::new();
let e_infile = Path::new("data/enums.txt");
let e_contents = fs::read_to_string(e_infile).unwrap();

for line in e_contents.lines().filter(|l| !l.trim().is_empty()) {
let mut it = line.splitn(3, ' ');
let name = it.next().unwrap();
let val_str = it.next().unwrap();
let val: Option<u16> = val_str.parse().ok();
let val: Option<u32> = val_str.parse().ok();
let docs = it.next();
let deprecated = docs
.map(|docs| docs.trim().to_uppercase() == "DEPRECATED")
Expand Down
21 changes: 8 additions & 13 deletions ic10emu/data/logictypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ AutoLand 226 Engages the automatic landing algorithm. The rocket will automatica
AutoShutOff 218 Turns off all devices in the rocket upon reaching destination
Bpm 103 Bpm
BurnTimeRemaining 225 Estimated time in seconds until fuel is depleted. Calculated based on current fuel usage.
Bypass None Bypasses some internal behavoiur of the atmospherics device.
CelestialHash 242
CelestialParentHash 250
Channel None Channel on a cable network which should be considered volatile
Channel0 165 Channel on a cable network which should be considered volatile
Channel1 166 Channel on a cable network which should be considered volatile
Channel2 167 Channel on a cable network which should be considered volatile
Channel3 168 Channel on a cable network which should be considered volatile
Channel4 169 Channel on a cable network which should be considered volatile
Channel5 170 Channel on a cable network which should be considered volatile
Channel6 171 Channel on a cable network which should be considered volatile
Channel7 172 Channel on a cable network which should be considered volatile
Channel0 165 Channel 0 on a cable network which should be considered volatile
Channel1 166 Channel 1 on a cable network which should be considered volatile
Channel2 167 Channel 2 on a cable network which should be considered volatile
Channel3 168 Channel 3 on a cable network which should be considered volatile
Channel4 169 Channel 4 on a cable network which should be considered volatile
Channel5 170 Channel 5 on a cable network which should be considered volatile
Channel6 171 Channel 6 on a cable network which should be considered volatile
Channel7 172 Channel 7 on a cable network which should be considered volatile
Charge 11 The current charge the device has
Chart 256
ChartedNavPoints 259
Expand Down Expand Up @@ -92,7 +90,6 @@ OperationalTemperatureEfficiency 150 How the input pipe's temperature effects th
OrbitPeriod 245
Orientation 230
Output 70 The output operation for a sort handling device, such as a stacker or sorter, when in logic mode the device will only action one repetition when set zero or above and then back to -1 and await further instructions
OverShootTarget None How far is the landing rocket going to overshoot its landing target at its current thrust. Expressed as a negative value in meters. ensure this is at zero by the time a rocket lands or risk total loss of rocket.
PassedMoles 234
Plant 68 Performs the planting action for any plant based machinery
PlantEfficiency1 52 DEPRECATED
Expand Down Expand Up @@ -228,7 +225,6 @@ SizeX 160 Size on the X (right) axis of the object in largeGrids (a largeGrid is
SizeY 161 Size on the Y(Up) axis of the object in largeGrids (a largeGrid is 2meters)
SizeZ 162 Size on the Z(Forward) axis of the object in largeGrids (a largeGrid is 2meters)
SolarAngle 22 Solar angle of the device
SolarConstant None Solar constant of the world
SolarIrradiance 176
SoundAlert 175 Plays a sound alert on the devices speaker
Stress 156 Machines get stressed when working hard. When Stress reaches 100 the machine will automatically shut down
Expand Down Expand Up @@ -257,7 +253,6 @@ TotalMolesOutput 135 Returns the total moles of the device's Output Network
TotalMolesOutput2 145 Returns the total moles of the device's Output2 Network
TotalQuantity 265
TrueAnomaly 251
Unknown None No description available
VelocityMagnitude 79 The current magnitude of the velocity vector
VelocityRelativeX 80 The current velocity X relative to the forward vector of this
VelocityRelativeY 81 The current velocity Y relative to the forward vector of this
Expand Down
17 changes: 11 additions & 6 deletions ic10emu/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections import defaultdict
from itertools import chain
from pathlib import Path

from typing import Any # type:ignore[reportAny]

def intOrNone(val: str):
try:
Expand Down Expand Up @@ -219,23 +219,28 @@ def update_enum(enum: dict[str, tuple[int | None, str]], values: dict[str, int])
logic_types_path = Path("data") / "logictypes.txt"
with logic_types_path.open(mode="w") as f:
for t, (v, help) in sorted(logictypes.items()):
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
if v is not None:
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
slot_logic_types_path = Path("data") / "slotlogictypes.txt"
with slot_logic_types_path.open(mode="w") as f:
for t, (v, help) in sorted(slotlogictypes.items()):
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
if v is not None:
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
batch_modes_path = Path("data") / "batchmodes.txt"
with batch_modes_path.open(mode="w") as f:
for t, (v, help) in sorted(batchmodes.items()):
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
if v is not None:
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
reagent_modes_path = Path("data") / "reagentmodes.txt"
with reagent_modes_path.open(mode="w") as f:
for t, (v, help) in sorted(reagentmodes.items()):
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
if v is not None:
_ = f.write(f"{t} {v} {help.replace("\r", "").replace("\n", "\\n")}\n")
enums_path = Path("data") / "enums.txt"
with enums_path.open(mode="w") as f:
for name, (val, help) in sorted(enums.items()):
_ = f.write(f"{name} {val} {help.replace("\r", "").replace("\n", "\\n")}\n")
if val is not None:
_ = f.write(f"{name} {val} {help.replace("\r", "").replace("\n", "\\n")}\n")

if __name__ == "__main__":
main()
Loading

0 comments on commit 5042337

Please sign in to comment.