Skip to content
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

Add Basic CI checks #2

Merged
merged 12 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Run Tests"

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-22.04
name: Run Tests
steps:
- name: Clone wake-extras
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download wake
run: wget https://github.com/sifive/wake/releases/download/v39.1.0/ubuntu-22-04-wake_39.1.0-1_amd64.deb

- name: Install wake
run: sudo apt-get install ./ubuntu-22-04-wake_39.1.0-1_amd64.deb

- name: Initialize wake
run: wake --init .

- name: Typecheck wake
run: wake -x 'Unit'

- name: Check formatting
run: wake-format --dry-run --auto
JakeSiFive marked this conversation as resolved.
Show resolved Hide resolved

- name: Run tests
run: ./tests/test.sh
2 changes: 1 addition & 1 deletion json.wake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package json

from wake import _
from utils import prefixError
from result import prefixError
from query import _

# Anyone who depends on json will also
Expand Down
17 changes: 17 additions & 0 deletions result.wake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package result

# When `result` is Fail, prefixes the internal error message with `prefix`
#
# Parameters:
# - `prefix`: The message to prepend to `result`
# - `result`: The Result which may be prepended to
#
# Examples:
# ```
# prefixError "foo" (Pass 123) -> Pass 123
# prefixError "foo" (Fail (Error "bar" stack)) => Fail (Error "foobar" stack)
# ```
export def prefixError (prefix: String): (result: Result a Error) => Result a Error = match _
Pass r -> Pass r
Fail (Error msg stack) -> Fail (Error "{prefix}{msg}" stack)

10 changes: 10 additions & 0 deletions tests/query.wake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package tests

from wake import _
from query import _

export def runQueryTests _ =
require 4, Nil = single 4
else failWithError "Unexpected value for single"

Pass Unit
5 changes: 5 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

set -ex

wake --in tests runQueryTests
Binary file added wake.db
Binary file not shown.
20 changes: 20 additions & 0 deletions wake.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{"hostname":"ashleycoleman-1518","message":"Initialized logging","time":"2023-11-09T10:37:12.339801280","pid":"389161","level":"info"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete plox

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dagnabbit

{"hostname":"ashleycoleman-1518","message":"Find all wakefiles took 0.000528 seconds","time":"2023-11-09T10:37:12.389306698","pid":"389161","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all sources took 0.002525 seconds","time":"2023-11-09T10:37:12.391908368","pid":"389161","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Scanning wake files took 0.029959 seconds","time":"2023-11-09T10:37:12.421971859","pid":"389161","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Initialized logging","time":"2023-11-09T10:37:36.977037223","pid":"389263","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all wakefiles took 0.000593 seconds","time":"2023-11-09T10:37:36.999100761","pid":"389263","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all sources took 0.003623 seconds","time":"2023-11-09T10:37:37.282091500","pid":"389263","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Scanning wake files took 0.027365 seconds","time":"2023-11-09T10:37:37.303157560","pid":"389263","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Initialized logging","time":"2023-11-09T10:39:04.276920097","pid":"389582","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all wakefiles took 0.000650 seconds","time":"2023-11-09T10:39:04.299846086","pid":"389582","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all sources took 0.003143 seconds","time":"2023-11-09T10:39:04.303086980","pid":"389582","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Scanning wake files took 0.032814 seconds","time":"2023-11-09T10:39:04.336037307","pid":"389582","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Initialized logging","time":"2023-11-09T10:47:05.608531993","pid":"389902","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all wakefiles took 0.000775 seconds","time":"2023-11-09T10:47:05.640209215","pid":"389902","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all sources took 0.003301 seconds","time":"2023-11-09T10:47:05.643622026","pid":"389902","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Scanning wake files took 0.029303 seconds","time":"2023-11-09T10:47:05.673054989","pid":"389902","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Initialized logging","time":"2023-11-09T10:47:12.712026536","pid":"389920","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all wakefiles took 0.000415 seconds","time":"2023-11-09T10:47:12.732957352","pid":"389920","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Find all sources took 0.003030 seconds","time":"2023-11-09T10:47:12.736060083","pid":"389920","level":"info"}
{"hostname":"ashleycoleman-1518","message":"Scanning wake files took 0.024125 seconds","time":"2023-11-09T10:47:12.760288650","pid":"389920","level":"info"}