Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emmabritton committed Jul 9, 2021
0 parents commit 1379839
Show file tree
Hide file tree
Showing 65 changed files with 10,689 additions and 0 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Rust

on:
push:
tags:
- v*
pull_request:
branches:
- master

env:
CARGO_TERM_COLOR: always

jobs:

rustfmt:
runs-on: ubuntu-20.04
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Get nightly Rust toolchain with rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt

- name: Run cargo fmt --all -- --check
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-20.04
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Get stable Rust toolchain with clippy
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: clippy

- name: Install linux libs
run: sudo apt-get update; sudo apt-get install --no-install-recommends pkg-config build-essential

- name: Run cargo clippy --all-targets -- -D clippy::all
run: cargo clippy --all-targets -- -D clippy::all

test:
runs-on: ubuntu-20.04
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Get stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Install linux libs
run: sudo apt-get update; sudo apt-get install --no-install-recommends pkg-config build-essential

- name: Run cargo check
run: cargo test

build_and_release:
if: startsWith(github.ref, 'refs/tags/v')
name: Build and Release
strategy:
fail-fast: false
matrix:
target:
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-gnu
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
name: tape_device-linux.tar.gz
- target: x86_64-apple-darwin
os: macOS-latest
name: tape_device-mac.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
name: tape_device-windows.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Run cargo check --all-targets
run: cargo check --all-targets

- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
toolchain: nightly
args: --release --target=${{ matrix.target }}

- name: Prepare build artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip tape_device.exe
7z a ../../../${{ matrix.name }} tape_device.exe
cd -
- name: Prepare build artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip tape_device
tar cvf ../../../${{ matrix.name }} tape_device
cd -
- uses: softprops/action-gh-release@v1
with:
files: ${{ matrix.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173 changes: 173 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@

# Created by https://www.toptal.com/developers/gitignore/api/rust,intellij+all,windows,macos,linux
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,intellij+all,windows,macos,linux

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/assembler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Rust ###
# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/rust,intellij+all,windows,macos,linux
30 changes: 30 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "tape_device"
version = "1.2.0"
description = "Executor, compiler and decompiler for fictional tape device"
authors = ["Ray Britton <raybritton@gmail.com>"]
edition = "2018"
readme = "README.md"
license-file = "LICENSE"

[[bin]]
name = "tape_device"

[lib]
name = "tape_device"

[dependencies]
anyhow = "1.0.40"
bitflags = "1.2.1"
chrono = "0.4.19"
clap = "2.33.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
crossterm = "0.19.0"
git-version = "0.3.4"
lazy_static = "1.4.0"
random-fast-rng = "0.1.1"
regex = "1.5.4"

[dev-dependencies]
tempfile = "3.2.0"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Ray Britton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 1379839

Please sign in to comment.