Skip to content

Commit

Permalink
Some inkwell stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat-Lafon committed Apr 7, 2024
1 parent 0d552b5 commit 8d50877
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 137 deletions.
45 changes: 27 additions & 18 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,55 @@ on:
- main
paths:
- '.github/workflows/rust.yaml'
- 'brilirs/**/*.rs'
- 'brilirs/**/*.toml'
- 'brilift/**/*.rs'
- 'brilift/**/*.toml'
- 'bril-rs/**/*.rs'
- 'bril-rs/**/*.toml'
- 'bril-rs/**/*.lalrpop'
- 'brilirs/**'
- 'brilift/**'
- 'bril-rs/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/rust.yaml'
- 'brilirs/**/*.rs'
- 'brilirs/**/*.toml'
- 'brilift/**/*.rs'
- 'brilift/**/*.toml'
- 'bril-rs/**/*.rs'
- 'bril-rs/**/*.toml'
- 'bril-rs/**/*.lalrpop'
- 'brilirs/**'
- 'brilift/**'
- 'bril-rs/**'

name: Workflow checks for rust code

env:
LLVM_VERSION : "15.0"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
test-code:
- "cd bril-rs && make test TURNTARGS=-v"
- "cd bril-rs && make features"
- "cd brilirs && make test TURNTARGS=-v"
- "cd brilirs && make benchmark TURNTARGS=-v"
- "cd brilift && cargo build --release && make rt.o && make test TURNTARGS=-v"
- "cd brilift && cargo build --release && make rt.o && make benchmark TURNTARGS=-v"
# Code requiring additional dependencies are separated out
include:
- test-code: "cd bril-rs && make features"
needs_cargo_hack: true
- test-code: "cd bril-rs/brillvm && cargo build && make rt"
needs_llvm: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
if: matrix.needs_llvm
with:
version: ${{ env.LLVM_VERSION }}

- name: Install cargo-hack for feature-flag checking
run: cargo install cargo-hack
if: matrix.needs_cargo_hack

- uses: actions/setup-python@v4
with:
Expand All @@ -56,7 +63,8 @@ jobs:
- name: Install Flit
run: pip install flit
- name: Install Python tools
run: cd bril-txt ; flit install --symlink
run: flit install --symlink
working-directory : './bril-txt'

- name: Install Turnt
# run: pip install turnt # Use instead if pip turnt version >= 1.7
Expand All @@ -65,7 +73,8 @@ jobs:
repository: cucapra/turnt
path: './turnt'
- name: Install Turnt part 2
run: cd turnt ; flit install --symlink
run: flit install --symlink
working-directory : './turnt'

- name: Problem matcher
run: echo '::add-matcher::.github/tap-matcher.json'
Expand All @@ -91,7 +100,7 @@ jobs:
uses: KyleMayes/install-llvm-action@v1
if: matrix.path == 'bril-rs/brillvm/Cargo.toml'
with:
version: "16.0"
version: ${{ env.LLVM_VERSION }}

- name: cargo check
run: cargo check --manifest-path ${{ matrix.path }} --all-targets
Expand Down
1 change: 0 additions & 1 deletion bril-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
description = "A rust representation of the Bril language"
readme = "README.md"
repository = "https://github.com/sampsyo/bril"
# license = "MIT"
license-file = "../LICENSE"
categories = ["command-line-utilities", "compilers", "data-structures", "parser-implementations"]
keywords = ["compiler", "bril", "parser", "data-structures", "language"]
Expand Down
31 changes: 31 additions & 0 deletions bril-rs/brillvm/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "./postCreateCommand.sh",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"extensions.verifySignature": false
}
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 4 additions & 0 deletions bril-rs/brillvm/.devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sudo apt-get update
sudo apt-get install -y llvm-17
sudo ln -s /usr/bin/llvm-config-17 /usr/local/bin/llvm-config
llvm-config --version
12 changes: 12 additions & 0 deletions bril-rs/brillvm/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
7 changes: 1 addition & 6 deletions bril-rs/brillvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ default-run = "main"

[dependencies]
clap = { version = "4.4", features = ["derive"] }
inkwell = { version = "0.2", features = ["llvm16-0"] }
inkwell = { version = "0.4", features = ["llvm17-0-prefer-dynamic"] }
libc-print = "0.1"

# For overriding parking_lot_core to latest version from 0.9.7
# To pull in the removal of `window-sys` which was causing duplicate dependencies
[patch.crates-io]
parking_lot_core = { git = "https://github.com/Amanieu/parking_lot" }

[dependencies.bril-rs]
path = ".."
features = ["float", "ssa", "memory"]
Expand Down
Loading

0 comments on commit 8d50877

Please sign in to comment.