Skip to content

Commit

Permalink
ci deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
tbmc committed Jun 11, 2024
1 parent 047470d commit 1f63174
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install curl & build essential to be compatible with nektos/act
run: apt-get update && apt-get install -y curl build-essential
- uses: actions-rust-lang/[email protected]
- name: Install clippy
run: rustup update && rustup component add clippy
- name: Build
working-directory: ./rust
run: cargo build
Expand Down Expand Up @@ -115,12 +120,13 @@ jobs:
if: github.event_name != 'pull_request'
steps:
- name: Run docker pull and up commands
# If using nektos/act, use appleboy/[email protected]
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
port: ${{ secrets.SERVER_PORT || 22 }}
script: |
cd ${{ secrets.SERVER_FOLDER_PATH }}
docker compose pull ${{ secrets.DOCKER_SERVICE_NAME }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

.idea/*
*.exe
.secrets
7 changes: 3 additions & 4 deletions golang/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module brainfuck

go 1.22

require (
github.com/gorilla/websocket v1.5.1 // indirect
golang.org/x/net v0.17.0 // indirect
)
require github.com/gorilla/websocket v1.5.1

require golang.org/x/net v0.17.0 // indirect
4 changes: 2 additions & 2 deletions rust/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ pub fn interpret_code(script: &str) -> Result<(), String> {
let stdout = &mut io::stdout();
let runtime = &mut Runtime::new(stdin, stdout);

return interpret_code_custom_runtime(script, runtime);
interpret_code_custom_runtime(script, runtime)
}

pub fn interpret_code_custom_runtime<'a>(script: &str, runtime: &mut Runtime) -> Result<(), String> {
pub fn interpret_code_custom_runtime(script: &str, runtime: &mut Runtime) -> Result<(), String> {
let ast = &parse_code(script)?;
info!("Parsed ok.");

Expand Down
7 changes: 6 additions & 1 deletion rust/src/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::io::{BufRead, Write};
use std::fmt::Write as FmtWrite;

const MAX_INSTRUCTIONS: usize = 5_000_000_000;
const ARRAY_SIZE: usize = 30_000;
Expand Down Expand Up @@ -44,7 +45,11 @@ impl<'a> Runtime<'a> {

pub fn dump_data(&self, exit: bool) {
println!("\nToo much instructions executed.\n");
let data: String = self.extract_data().iter().map(|x| format!("{} ", x)).collect();
let data = self.extract_data().iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b}");
output
});
// let data: String = self.extract_data().iter().map(|x| format!("{} ", x)).collect();
println!("Data:\nCurrent pointer: {}\n{}\n", self.ptr, data);
if exit {
std::process::exit(0);
Expand Down

0 comments on commit 1f63174

Please sign in to comment.