]> Repositorios git - scryer-prolog.git/commitdiff
Add cache step to test workflow
authorinfogulch <[email protected]>
Sat, 1 Apr 2023 23:11:35 +0000 (18:11 -0500)
committerinfogulch <[email protected]>
Sun, 2 Apr 2023 07:09:41 +0000 (02:09 -0500)
.github/workflows/test.yml
Cargo.toml
README.md
scryer-prolog.wxs

index edcd1993bb817f3a958386e344ab183f4b3606e2..aeffd7e998c67c8e53f8158336d6caca9f884ecb 100644 (file)
@@ -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/[email protected]
-        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 }}
index 9e2ca8839a0647c03009573dde6fc04e54acfb09..975ba64fdbd773e64d11409b9a014caec4df5a52 100644 (file)
@@ -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"
index 12ec693409d9ca1aec6695216e1862ea2add30a7..93d7a43cacab9a9aa2bef7d7a954513bad82d9ff 100644 (file)
--- 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&nbsp;`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
 
index 53b212429f624d2da786d26e9121d80f52790f73..b69b1dff457ff1d103b837beef59d84bdc583769 100644 (file)
@@ -4,7 +4,6 @@
     <Package Description="An open source industrial strength production environment for ISO Prolog that is also a testbed for bleeding edge research in logic and constraint programming, which is itself written in a high-level language." Platform="x64" Keywords="prolog" Id="*" Compressed="yes" InstallScope="perMachine" InstallerVersion="300" Languages="1033" SummaryCodepage="1252" Manufacturer="Scryer Prolog contributors"/>\r
     <Property Id="APPHELPLINK" Value="https://github.com/mthom/scryer-prolog"/>\r
     <Media Id="1" Cabinet="scryer.cab" EmbedCab="yes" />\r
-    \r
     <Directory Id="TARGETDIR" Name="SourceDir">\r
       <Directory Id="ProgramFilesFolder" Name="PFiles">\r
         <Directory Id="INSTALLDIR" Name="Scryer Prolog">\r
         </Directory>\r
       </Directory>\r
       <Directory Id="ProgramMenuFolder">\r
-       <Component Id="ApplicationShortcut" Guid="8c9b14a3-e7b1-4d30-a892-61d7371dcae2">\r
+        <Component Id="ApplicationShortcut" Guid="8c9b14a3-e7b1-4d30-a892-61d7371dcae2">\r
           <Shortcut Id="ApplicationStarMenuShortcut" Name="Scryer Prolog" Description="Launch Scryer Prolog" Target="[#ScryerPrologEXE]" WorkingDirectory="INSTALLDIR"/>\r
-         <RemoveFolder Id="ApplicationShortcut" On="uninstall"/>\r
-         <RegistryValue Root="HKCU" Key="Software\Microsoft\ScryerProlog" Name="installed" Type="integer" Value="1" KeyPath="yes"/>\r
-       </Component>\r
+          <RemoveFolder Id="ApplicationShortcut" On="uninstall"/>\r
+          <RegistryValue Root="HKCU" Key="Software\Microsoft\ScryerProlog" Name="installed" Type="integer" Value="1" KeyPath="yes"/>\r
+        </Component>\r
       </Directory>\r
     </Directory>\r
-\r
     <Feature Id="Complete" Level="1" Display="expand" ConfigurableDirectory="INSTALLDIR">\r
       <ComponentRef Id="MainExecutable"/>\r
       <ComponentRef Id="ApplicationShortcut"/>\r
     </Feature>\r
   </Product>\r
-</Wix>\r
-  \r
+</Wix>
\ No newline at end of file