-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial CI build #62
base: master
Are you sure you want to change the base?
Initial CI build #62
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
# The NAME makes it easier to copy/paste snippets from other CI configs | ||
NAME: mir-json | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deps | ||
run: | | ||
rustup default nightly-2023-01-23 | ||
rustup component add clippy rustc-dev | ||
- uses: Swatinem/rust-cache@v2.7.0 | ||
# TODO: Fix lints, use --deny warnings | ||
- name: Lint | ||
run: cargo clippy | ||
|
||
test: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps this should be named " |
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deps | ||
run: | | ||
rustup default nightly-2023-01-23 | ||
rustup component add rustc-dev | ||
- uses: Swatinem/rust-cache@v2.7.0 | ||
# TODO: Fix builds of examples, run tests | ||
# - run: cargo test --locked --no-run | ||
# - run: cargo test | ||
- run: cargo build --bin=mir-json --release | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v3 | ||
if: github.repository == 'GaloisInc/${{ env.NAME }}' | ||
with: | ||
name: "${{ env.NAME }}" | ||
path: "target/release/${{ env.NAME }}" | ||
if-no-files-found: error | ||
Comment on lines
+40
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you confirmed that the resulting binary is actually usable if the toolchain isn't installed? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ fn main() { | |
// Add the toolchain lib/ directory to `-L`. This fixes the linker error "cannot find | ||
// -lLLVM-13-rust-1.60.0-nightly". | ||
let out = Command::new("rustup") | ||
.args(&["which", "rustc"]) | ||
.args(["which", "rustc"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is surprising. What motivated this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clippy! I can revert it if you prefer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right! Perhaps this belongs in a separate commit to make this clearer. |
||
.output().unwrap(); | ||
assert!(out.status.success()); | ||
let rustc_path = Path::new(str::from_utf8(&out.stdout).unwrap().trim_end()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should configure the cache a bit more to make it behave like our typical Haskell GHA setups. After reading the
rust-cache
README a bit, I think we should tweak the following:cache-on-failure
so that build dependencies will still cache even if buildingmir-json
itself fails.prefix-key: ${{ env.CACHE_VERSION }}
, whereCACHE_VERSION
is a GHA environment variable.Similarly for the use of
rust-cache
in the other job below.