Files
scryer-prolog/.github/workflows/test.yml
2023-04-02 17:31:20 -05:00

87 lines
3.3 KiB
YAML

name: Test
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { os: windows-latest, rust-version: stable, shell: 'msys2 {0}' }
- { os: macos-11, 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: ${{ matrix.shell }}
steps:
- 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
- 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
# Run code formatting and style checks 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 --no-deps || 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
echo "$PWD/target/release" >> $GITHUB_PATH
- name: Publish artifact
if: matrix.rust-version == 'stable'
uses: actions/upload-artifact@v3
with:
path: target/release/scryer-prolog*
name: scryer-prolog_${{ matrix.os }}
# Run iso compliance tests.
- name: Install Logtalk
if: startsWith(matrix.os,'ubuntu') && matrix.rust-version == 'stable'
uses: logtalk-actions/setup-logtalk@master
with:
logtalk-version: git
logtalk-tool-dependencies: false
- name: Run compliance test suite
if: startsWith(matrix.os,'ubuntu') && matrix.rust-version == 'stable'
working-directory: /home/runner/logtalk/tests/prolog
run: |
scryer-prolog -v
logtalk_tester -p scryer -g "set_logtalk_flag(clean,off)" -w -t 360