From 8792ee438c3a6d1319ec06a65460b76396e42e64 Mon Sep 17 00:00:00 2001 From: infogulch Date: Sat, 1 Apr 2023 18:11:35 -0500 Subject: [PATCH] Add cache step to test workflow --- .github/workflows/test.yml | 110 +++++++++++++++++++------------------ Cargo.toml | 6 +- README.md | 6 +- scryer-prolog.wxs | 13 ++--- 4 files changed, 67 insertions(+), 68 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index edcd1993..aeffd7e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,66 +6,68 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, macos-10.15] - rust-version: [stable, beta] - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust-version }} - override: true - - name: Build lib - uses: actions-rs/cargo@v1 - with: - command: rustc - args: --verbose --lib -- -D warnings - - name: Build bin - uses: actions-rs/cargo@v1 - with: - command: rustc - args: --verbose --bin scryer-prolog -- -D warnings - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --verbose --all - - name: Num tests - uses: actions-rs/cargo@v1 - continue-on-error: true - with: - command: test - args: --verbose --all --no-default-features --features num - msrv: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04, macos-10.15] - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install cargo-msrv - uses: baptiste0928/cargo-install@v1.1.0 - with: - crate: cargo-msrv - - name: Verify MSRV - run: cargo msrv --verify - windows: - runs-on: windows-latest + include: + - { os: windows-latest, rust-version: stable, shell: 'msys2 {0}' } + - { os: macos-10.15, rust-version: stable, shell: bash } + - { os: ubuntu-20.04, rust-version: stable, shell: bash } + - { os: ubuntu-20.04, rust-version: 1.63, shell: bash } + - { os: ubuntu-20.04, rust-version: beta, shell: bash } + - { os: ubuntu-20.04, rust-version: nightly, shell: bash } defaults: run: - shell: msys2 {0} + shell: ${{ matrix.shell }} + outputs: + os: ${{ matrix.os }} + rust-version: ${{ matrix.rust-version }} steps: - - name: Setup MSYS2 - uses: msys2/setup-msys2@v2 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + if: "!startsWith(matrix.os, 'windows')" + id: toolchain + with: + toolchain: ${{ matrix.rust-version }} + components: clippy, rustfmt + - uses: msys2/setup-msys2@v2 + if: startsWith(matrix.os,'windows') with: update: true install: >- base-devel mingw-w64-x86_64-rust - - name: Checkout sources - uses: actions/checkout@v3 - - name: Test on Windows + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.os }}_rustc-${{ steps.toolchain.outputs.cachekey }}_cargo-${{ hashFiles('**/Cargo.lock') }} + + # Build and test. + - name: Build library + run: cargo rustc --verbose --lib -- -D warnings + - name: Test run: cargo test --verbose --all + + # Only run formatting & style check on one job to not spam warnings. + - name: Check formatting + if: startsWith(matrix.os,'ubuntu') && matrix.rust-version == 'stable' + run: cargo fmt --check || echo "::warning ::cargo fmt found some formatting changes that may improve readability" + - name: Check clippy + if: startsWith(matrix.os,'ubuntu') && matrix.rust-version == 'stable' + run: cargo clippy || echo "::warning ::cargo clippy found some code style changes that may be more idiomatic" + + # On stable rust builds, build a binary and publish as a github actions + # artifact. These binaries could be useful for testing the pipeline but + # are only retained by github for 90 days. + # TODO: Check that they actually work. + - name: Build release binary + if: matrix.rust-version == 'stable' + run: cargo rustc --verbose --bin scryer-prolog --release -- -D warnings + - name: Publish artifact + if: matrix.rust-version == 'stable' + uses: actions/upload-artifact@v3 + with: + path: target/release/scryer-prolog* + name: scryer-prolog_${{ matrix.os }} diff --git a/Cargo.toml b/Cargo.toml index 9e2ca883..975ba64f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ license = "BSD-3-Clause" keywords = ["prolog", "prolog-interpreter", "prolog-system"] categories = ["command-line-utilities"] build = "build/main.rs" -rust-version = "1.61" +rust-version = "1.63" [features] default = ["rug"] @@ -41,7 +41,7 @@ libc = "0.2.62" modular-bitfield = "0.11.2" ctrlc = "3.2.2" ordered-float = "2.6.0" -phf = { version = "0.9", features = ["macros"] } +phf = { version = "0.9", features = ["macros"] } ref_thread_local = "0.0.0" rug = { version = "1.15.0", optional = true } rustyline = "9.0.0" @@ -49,7 +49,7 @@ ring = "0.16.13" ripemd160 = "0.8.0" sha3 = "0.8.2" blake2 = "0.8.1" -crrl ="0.2.0" +crrl = "0.2.0" native-tls = "0.2.4" chrono = "0.4.11" select = "0.4.3" diff --git a/README.md b/README.md index 12ec6934..93d7a43c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Extend Scryer Prolog to include the following, among other features: characters, using a packed internal representation. - [x] clp(B) and clp(ℤ) as builtin libraries. - [x] Streams and predicates for stream control. - - [x] A simple sockets library representing TCP connections as streams. + - [x] A simple sockets library representing TCP connections as streams. - [x] Incremental compilation and loading process, newly written, primarily in Prolog. - [ ] Improvements to the WAM compiler and heap representation: @@ -131,7 +131,7 @@ After compilation, the executable `scryer-prolog` is available in the directory `target/release` and can be invoked to run the system. On Windows, Scryer Prolog is easier to build inside a [MSYS2](https://www.msys2.org/) -environment as some crates may require native C compilation. However, +environment as some crates may require native C compilation. However, the resulting binary does not need MSYS2 to run. When executing Scryer in a shell, it is recommended to use a more advanced shell than mintty (the default MSYS2 shell). The [Windows Terminal](https://github.com/microsoft/terminal) works correctly. To build a Windows Installer, you'll need first Scryer Prolog compiled in release mode, then, with WiX Toolset installed, execute: @@ -141,7 +141,7 @@ light.exe scryer-prolog.wixobj ``` It will generate a very basic MSI file which installs the main executable and a shortcut in the Start Menu. It can be installed with a double-click. To uninstall, go to the Control Panel and uninstall as usual. -Scryer Prolog must be built with **Rust 1.61 and up**. +Scryer Prolog must be built with **Rust 1.63 and up**. ### Docker Install diff --git a/scryer-prolog.wxs b/scryer-prolog.wxs index 53b21242..b69b1dff 100644 --- a/scryer-prolog.wxs +++ b/scryer-prolog.wxs @@ -4,7 +4,6 @@ - @@ -14,18 +13,16 @@ - + - - - + + + - - - + \ No newline at end of file -- 2.54.0