diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml new file mode 100644 index 0000000000..4835609e38 --- /dev/null +++ b/.github/workflows/Build.yaml @@ -0,0 +1,71 @@ +on: + push: + branches: master + workflow_dispatch: +name: Build +defaults: + run: + shell: bash + working-directory: code +jobs: + auto-cancel: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ github.token }} + build: + needs: auto-cancel + name: "Build & Deploy" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: "Update apt package list" + run: sudo apt-get update + - name: "Install system requirements" + run: sudo apt-get install -y libgmp-dev python3 graphviz doxygen fonts-lmodern texlive-bibtex-extra texlive-latex-extra texlive-science texlive-xetex texlive-luatex g++ default-jdk mono-devel + - name: "Install Stack" + uses: haskell/actions/setup@v1 + with: + enable-stack: true + stack-no-global: true + stack-version: 'latest' + - name: "Update PATH" + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.swift/usr/bin" >> $GITHUB_PATH + - name: "HLint" + run: curl --max-time 60 -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . + - name: "Install dependencies" + run: stack --no-terminal test --bench --only-dependencies + - name: "Build" + run: make prog stackArgs="--no-terminal" GHCFLAGS="-Werror" + - name: "Stable" + run: make stackArgs="--no-terminal" NOISY=yes + - name: "TeX" + run: make tex SUMMARIZE_TEX=yes + - name: "Code" + run: make code + - name: "Doxygen" + run: make doxygen + - name: "Docs" + run: make docs haddockArgs="--no-haddock-deps --no-haddock-hyperlink-source" + - name: "Graphs" + run: make graphs + - name: "Build website" + run: | + LABEL_FILE=/tmp/ci_build_failures \ + MANAGED_LABEL_FILE=/tmp/ci_managed_labels \ + ALL_FUNCTIONS_FILE=$(mktemp) \ + SHELL_OPTS_FILE=$(mktemp) \ + bash scripts/deploy_wrapper.bash + - name: "Deploy 🚀" + uses: JamesIves/github-pages-deploy-action@4.1.3 + with: + git-config-name: ${{ secrets.BOT_NAME }} + git-config-email: ${{ secrets.BOT_EMAIL }} + token: ${{ secrets.BOT_TOKEN }} + branch: gh-pages + folder: code/deploy + commit-message: "${{ secrets.BOT_NAME }} deploy of master@${{ github.sha }}" diff --git a/.github/workflows/Drasil.yaml b/.github/workflows/Test.yaml similarity index 96% rename from .github/workflows/Drasil.yaml rename to .github/workflows/Test.yaml index 2c3a83d3b6..6a1a1cd7ad 100644 --- a/.github/workflows/Drasil.yaml +++ b/.github/workflows/Test.yaml @@ -4,7 +4,7 @@ on: pull_request: branches: master workflow_dispatch: -name: Drasil +name: Test defaults: run: shell: bash @@ -69,5 +69,3 @@ jobs: run: make docs haddockArgs="--no-haddock-deps --no-haddock-hyperlink-source" - name: "Graphs" run: make graphs - - name: "Test Deploy" - run: sh scripts/maybe_test_deploy.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fa58d67232..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,107 +0,0 @@ -# This is the simple Travis configuration, which is intended for use -# on applications which do not require cross-platform and -# multiple-GHC-version support. For more information and other -# options, see: -# -# https://docs.haskellstack.org/en/stable/travis_ci/ -# -# Copy these contents into the root directory of your Github project in a file -# named .travis.yml - -# Use new container infrastructure to enable caching -sudo: false -dist: xenial - -# Do not choose a language; we provide our own build tools. -language: generic - -branches: - except: - - gh-pages - -env: - global: - - secure: "zpSgEG8GvxOl8qJl+3OLiW7p5KdvzOOkC9g2ukLftmJ5cQUO2c7Zr7g/L/6ZQak96eDjyinV953laKXnrgy0BhZV1lnwPrnfEnvIV8BRkxIJ2XjMv3oNmwvAX5ayAKzeE7LBqeQyuFf83K+NP8QV5N432Ar9PryoJC5HvK4B/iQ1SuzWYcFSSuowNC1oukQUCKBVyzuhjv88VrZWqj2pLb7QgWlKNfokMsyYgNSytbu4A8xBn3zd51z2wgIjvfQlW9YnmENrloqPd4EcTnnjE+/2g4OSJ5ULWAu3n2QWmO5X5MhI7yGfQsH8fSR1pPSjw6iGYQ8G9woci5kyWCKCYZvYMUWUEZY6+vP+xhknRxkN9X/s9v6S9/Di2kKU0kOxcZC4p+9RF0NT3cZDzValhhRINAiprQYX8ri5G+BOq2fsKyENezvc+OuLvEHXhvskMuuZUJuWYB0ScUYooqIRgJE79Fr3d1EjDM0cQwFrMbOt6LF1P3wgPMo06Zy+4dfgqEx/heeKxX1yNFFbdd5WaSqhWac/7s4Y4v4UKHwbpKwZ1KjlW464VC/Dtwdwc/yS/iHRlcTdBjLl3MNdBA2sdxbDfsuao5osnCLdnt/qQ5B4cRpy3fJkbsmyNfLF57aE3bqpneUWHWrmbhgQ5PSRW6nyKpqgQkyzFD8B0WbfzIM=" - - secure: "OiCqBb3REAAkRLkynqsC9pN0K3b2oBAOCaFi2wGeeOMWbyql6PTUUaa1effRmb5l9llqVW3MN2g3iaFp3PjghQeoUIYPJnZ6QptR90j6L07UxQI/ZgEHyTYB3HKOxkHPeRk298HEvW36aFNik6Dmt6prnzElYsEeh6sPDiGYHO+cKWtvvUCM89qt9/aFcYE4Rn4Omr3+5uN62L/9Fi0XGKdnA+jORaqt6ARHYmycvqN407xHbvHQNun27ft1VOFLDCmOLFJJa7Nc462yy11DHKtLWcT3bj5oa1cK79o8Frp4KFSbZ8HXKFVz/AdR2fKCE/Iptek0TAJjR01YQOR6PcSrBbHiCMcZ83izyb6svourSJN30/wBxQwGedL7/f/p9NFOdF5AgK90Q+emQYDUDFXp6T4Sl1WFzV41wwdF6scfptrRLMYKNGm0QOxr8/TcyQk8GorlQM4NIOCGZRXx1oXcc2F3jXZ6vnbnGE0bl2m2vG1JYgdXCoTiCZbTJgJn6ZnfVT58JiVXzFCW9D9GPshMHwoTo/3CGfq1EObndyzwgiSgPgNFn58dT699Qu8DVlMgWcbMr+OGa+4hMGCpsD/qHF9qXmcZuJXaXo+T/Bua20a1ShAbP5OUT5ZcofI4N+N1QnxJv0N7pX1ts26fiWJV5OjE27sZP/Kt3X2yRew=" - - LABEL_FILE=/tmp/ci_build_failures - - MANAGED_LABEL_FILE=/tmp/ci_managed_labels - - ALL_FUNCTIONS_FILE=$(mktemp) - - SHELL_OPTS_FILE=$(mktemp) - -# Caching so the next build will be fast too. -cache: - directories: - - $HOME/.stack - -# Ensure necessary system libraries are present -addons: - apt: - packages: - - libgmp-dev - - python3 - - graphviz - - doxygen -# TeX Building - - fonts-lmodern - - texlive-bibtex-extra - - texlive-latex-extra - - texlive-math-extra - - texlive-xetex - - texlive-luatex -# Code Building - - g++ - - default-jdk - - mono-devel - -before_install: -# Download and unpack the stack executable -- mkdir -p ~/.local/bin -- mkdir -p ~/.swift -- export PATH=$HOME/.local/bin:$HOME/.swift/usr/bin:$PATH -- source code/scripts/ci_functions.bash -- ci_retry "curl --max-time 60 -sSL https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'" -# FIXME: Hardcoded version, not rolling -- ci_retry "curl --max-time 60 -sSL https://swift.org/builds/swift-5.2.4-release/ubuntu1604/swift-5.2.4-RELEASE/swift-5.2.4-RELEASE-ubuntu16.04.tar.gz | tar xz --strip-components=1 -C ~/.swift" -- echo "print(\"Hello World\")" > ~/test.swift - -install: -# Build dependencies -- stack --no-terminal --install-ghc test --only-dependencies --stack-yaml code/stack.yaml - -script: - - ci_export_funcs - - cd code - - >- - ci_fstep "CI: HLint" "ci_retry \"curl --max-time 60 -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .\"" - - >- - ci_fstep "CI: Build" make prog stackArgs="--no-terminal" GHCFLAGS=-Werror - - >- - ci_fstep "CI: Stable" make stackArgs="--no-terminal" NOISY=yes - - >- - ci_fstep "CI: TeX" make tex SUMMARIZE_TEX=yes - - >- - ci_fstep "CI: Code" make code - - >- - ci_fstep "CI: Doxygen" make doxygen - - >- - ci_fstep "CI: Docs" make docs haddockArgs=\"--no-haddock-deps --no-haddock-hyperlink-source\" - - >- - ci_fstep "CI: Graphs" make graphs - - >- - ci_fstep "CI: Deploy" sh scripts/maybe_test_deploy.sh - - python3 scripts/pr_label_update.py - -deploy: - provider: script - skip_cleanup: true - script: bash scripts/deploy_wrapper.bash - on: - branch: master - -notifications: - email: - - szymczdm@mcmaster.ca - - carette@mcmaster.ca - - smiths@mcmaster.ca - on_success: change - on_failure: always diff --git a/README.md b/README.md index 2c4cae0185..207cd22114 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Drasil [![Build Status](https://travis-ci.com/JacquesCarette/Drasil.svg?branch=master)](https://travis-ci.com/JacquesCarette/Drasil) +Drasil [![Build Status](https://github.com/JacquesCarette/Drasil/actions/workflows/Build.yaml/badge.svg?branch=master)](https://github.com/JacquesCarette/Drasil/actions/workflows/Build.yaml) [![DOI](https://zenodo.org/badge/23760783.svg)](https://zenodo.org/badge/latestdoi/23760783) ==================================================== @@ -117,14 +117,11 @@ See the [README](https://github.com/JacquesCarette/Drasil/tree/master/code#build - Assorted general/administrative notes .gitattributes - - Used by git + - Used by git (set language attributes so GitHub Linguist calculates code statistics as desired) .gitignore - Used by git (specifies which file(type)s to ignore when committing) -.travis.yml - - Used for continuous integration with Travis CI - LICENSE - License information diff --git a/code/drasil-data/Data/Drasil/Concepts/Math.hs b/code/drasil-data/Data/Drasil/Concepts/Math.hs index dc60c5b7a6..7d1173f7be 100644 --- a/code/drasil-data/Data/Drasil/Concepts/Math.hs +++ b/code/drasil-data/Data/Drasil/Concepts/Math.hs @@ -12,19 +12,18 @@ import Control.Lens ((^.)) mathcon :: [ConceptChunk] mathcon = [amplitude, angle, area, axis, calculation, cartesian, centre, change, component, - constraint, diameter,equation, euclidN, euclidSpace, gradient, graph, laplaceTransform, law, line, matrix, - norm, normal, normalV, number, orient, parameter, perp, perpV, pi_, negInf, posInf, point, - probability, rOfChng, rate, rightHand, shape, surArea, surface, unitV, unit_, vector, + constraint, diameter, direction, equation, euclidN, euclidSpace, gradient, graph, laplaceTransform, law, line, matrix, + norm, normal, normalV, number, orient, origin, parameter, perp, perpV, pi_, negInf, posInf, positive, negative, + point, probability, rOfChng, rate, rightHand, shape, surArea, surface, unitV, unit_, vector, xAxis, xCoord, xComp, xDir, yAxis, yCoord, yComp, yDir, zAxis, zCoord, zComp, zDir, iAngle] mathcon' :: [CI] mathcon' = [de, leftSide, ode, pde, rightSide] -amplitude, angle, area, axis, calculation, cartesian, centre, change, component, constraint, - diameter, equation, euclidN, euclidSpace, gradient, graph, laplaceTransform, law, line, matrix, norm, - normal, normalV, number, orient, parameter, perp, perpV, pi_, negInf, posInf, point, probability, +amplitude, angle, area, axis, calculation, cartesian, centre, change, component, constraint, diameter, + direction, equation, euclidN, euclidSpace, gradient, graph, laplaceTransform, law, line, matrix, norm, normal, normalV, + number, orient, origin, parameter, perp, perpV, pi_, negInf, posInf, positive, negative, point, probability, rOfChng, rate, rightHand, shape, surArea, surface, unitV, unit_, vector, xAxis, xCoord, xComp, xDir, - yAxis, yCoord, yComp, yDir, zAxis, zCoord, zComp, zDir, iAngle :: ConceptChunk @@ -44,6 +43,7 @@ component = dcc "component" (nounPhrase "component" "components") ("The sc constraint = dcc "constraint" (cn' "constraint") "A condition that the solution must satisfy" diameter = dcc "diameter" (cn' "diameter") ("Any straight line segment that passes through the center of the circle" ++ "and whose endpoints lie on the circle.") +direction = dcc "direction" (cn' "direction") "'which way' a vector points, extending from the tail to the tip" equation = dcc "equation" (cn' "equation") "A statement that the values of two mathematical expressions are equal " euclidSpace = dcc "euclidSpace" (cn' "Euclidean") ("Denoting the system of geometry corresponding to the geometry of ordinary" ++ "experience") @@ -60,12 +60,15 @@ norm = dcc "norm" (cn' "norm") "the positive l normal = dcc "normal" (cn' "normal" ) "an object that is perpendicular to a given object" number = dcc "number" (cn' "number") "a mathematical object used to count, measure, and label" orient = dcc "orientation" (cn' "orientation") "the relative physical position or direction of something" +origin = dcc "origin" (cn' "origin") "a fixed point of reference for the geometry of the surrounding space" parameter = dcc "parameter" (cn' "parameter") "a quantity whose value is selected depending on particular circumstances" --FIXME: Should "parameter" be in math? perp = dcc "perp" (cn' "perpendicular") "At right angles" pi_ = dcc "pi" (cn' "ratio of circumference to diameter for any circle") "The ratio of a circle's circumference to its diameter" posInf = dcc "PosInf" (cn' "Positive Infinity") "the limit of a sequence or function that eventually exceeds any prescribed bound" negInf = dcc "NegInf" (cn' "Negative Infinity") "Opposite of positive infinity" +positive = dcc "positive" (cn' "positive") "greater than zero" +negative = dcc "negative" (cn' "negative") "less than zero" point = dccWDS "point" (pn' "point") $ S "An exact location, it has no size, only position" +:+ sParen (S "from" +:+ makeRef2S pointSource) probability = dcc "probability" (cnIES "probability") "The likelihood of an event to occur" diff --git a/code/drasil-example/Drasil/DblPendulum/Assumptions.hs b/code/drasil-example/Drasil/DblPendulum/Assumptions.hs index 596a6c5241..baa986c425 100644 --- a/code/drasil-example/Drasil/DblPendulum/Assumptions.hs +++ b/code/drasil-example/Drasil/DblPendulum/Assumptions.hs @@ -4,7 +4,7 @@ import Language.Drasil import qualified Utils.Drasil.Sentence as S import Data.Drasil.Concepts.Documentation (assumpDom) -import Data.Drasil.Concepts.Math (cartesian, xAxis, yAxis) +import Data.Drasil.Concepts.Math (cartesian, xAxis, yAxis, direction, origin, positive) import Data.Drasil.Concepts.Physics (gravity, twoD, pendulum, motion) @@ -26,12 +26,12 @@ cartCoordDesc :: Sentence cartCoordDesc = S "A" +:+ (phrase cartesian `S.sIs` S "used") cartCoordRightDesc :: Sentence -cartCoordRightDesc = S "The" +:+ phrase cartesian `S.sIs` S "right-handed where positive" +:+. +cartCoordRightDesc = S "The" +:+ phrase cartesian `S.sIs` S "right-handed where" +:+ phrase positive +:+. phrase xAxis `S.sAnd` phrase yAxis +:+ S "point right up" yAxisDirDesc :: Sentence -yAxisDirDesc = S "direction" `S.the_ofThe'` phrase yAxis `S.sIs` S "directed opposite to" +:+. phrase gravity +yAxisDirDesc = phrase direction `S.the_ofThe'` phrase yAxis `S.sIs` S "directed opposite to" +:+. phrase gravity startOriginDesc :: Sentence -startOriginDesc = S "The" +:+. (phrase pendulum `S.sIs` S "attached" `S.toThe` S "origin") +startOriginDesc = S "The" +:+. (phrase pendulum `S.sIs` S "attached" `S.toThe` phrase origin) diff --git a/code/drasil-example/Drasil/DblPendulum/GenDefs.hs b/code/drasil-example/Drasil/DblPendulum/GenDefs.hs index ae9dc776a6..760348153a 100644 --- a/code/drasil-example/Drasil/DblPendulum/GenDefs.hs +++ b/code/drasil-example/Drasil/DblPendulum/GenDefs.hs @@ -10,7 +10,7 @@ import Utils.Drasil import qualified Utils.Drasil.Sentence as S -- import Data.Drasil.Concepts.Documentation (coordinate, symbol_) -import Data.Drasil.Concepts.Math (xComp, yComp, equation, component, angle) +import Data.Drasil.Concepts.Math (xComp, yComp, equation, component, direction, angle) import Data.Drasil.Quantities.Physics(xPos, yPos, velocity, angularVelocity, xVel, yVel, angularAccel, xAccel, yAccel, acceleration, force, tension, gravitationalAccel, angularFrequency, torque, momentOfInertia, angularDisplacement, time, @@ -63,7 +63,7 @@ velocityIXDerivSent2 = S "We also know the" +:+ phrase horizontal +:+ phrase pos velocityIXDerivEqn2 = sy xPos $= sy lenRod * sin (sy pendDisplacementAngle) velocityIXDerivSent3 = S "Applying this," velocityIXDerivEqn3 = sy xVel $= deriv (sy lenRod * sin (sy pendDisplacementAngle)) time -velocityIXDerivSent4 = E (sy lenRod) `S.sIs` S "constant with respect to time, so" +velocityIXDerivSent4 = E (sy lenRod) `S.sIs` S "constant" `wrt` S "time, so" velocityIXDerivEqn4 = sy xVel $= sy lenRod * deriv (sin (sy pendDisplacementAngle)) time velocityIXDerivSent5 = S "Therefore, using the chain rule," @@ -99,7 +99,7 @@ velocityIYDerivSent2 = S "We also know the" +:+ phrase vertical +:+ phrase posit velocityIYDerivEqn2 = sy yPos $= negate (sy lenRod * cos (sy pendDisplacementAngle)) velocityIYDerivSent3 = S "Applying this again," velocityIYDerivEqn3 = sy yVel $= negate (deriv (sy lenRod * cos (sy pendDisplacementAngle)) time) -velocityIYDerivSent4 = E (sy lenRod) `S.sIs` S "constant with respect to time, so" +velocityIYDerivSent4 = E (sy lenRod) `S.sIs` S "constant" `wrt` S "time, so" velocityIYDerivEqn4 = sy yVel $= negate (sy lenRod * deriv (cos (sy pendDisplacementAngle)) time) velocityIYDerivSent5 = S "Therefore, using the chain rule," @@ -246,7 +246,7 @@ angFrequencyDerivSent1 = foldlSentCol [S "Consider the", phrase torque, S "on a" phrase weight `S.the_ofThe` phrase pendulum), S "bob that acts along the" +:+. phrase arcLen, (phrase torque `S.isThe` phrase len) `S.the_ofThe'` S "string", ch lenRod, S "multiplied by", S "component" `S.the_ofThe` S "net", phrase force, S "that is perpendicular to", S "radius" `S.the_ofThe` (S "arc" !.), - S "The minus sign indicates the", phrase torque, S "acts in the opposite direction of the", phrase angularDisplacement] + S "The minus sign indicates the", phrase torque, S "acts in the opposite", phrase direction `S.ofThe` phrase angularDisplacement] angFrequencyDerivEqn1 = sy torque $= negate (sy lenRod) * (sy mass * sy gravitationalAccel * sin (sy pendDisplacementAngle)) diff --git a/code/drasil-example/Drasil/DblPendulum/IMods.hs b/code/drasil-example/Drasil/DblPendulum/IMods.hs index de317203ca..3b2a248965 100644 --- a/code/drasil-example/Drasil/DblPendulum/IMods.hs +++ b/code/drasil-example/Drasil/DblPendulum/IMods.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE PostfixOperators #-} module Drasil.DblPendulum.IMods (iMods, angularDisplacementIM) where import Prelude hiding (cos, sin) @@ -53,9 +54,9 @@ angularDisplacementDerivSent1 = foldlSentCol [S "When the", phrase pendulum `S.s S "the", phrase equation `S.sOf` phrase motion, S "for the", phrase pendulum, S "may be obtained"] -angularDisplacementDerivSent2 = foldlSentCol [S "Where", ch torque +:+ S "denotes the", phrase torque `sC` - ch momentOfInertia +:+ S "denotes the", phrase momentOfInertia `S.sAnd` ch angularAccel +:+ - S "denotes the", phrase angularAccel +:+ S "This implies"] +angularDisplacementDerivSent2 = foldlSentCol [S "Where", ch torque `S.denotes` phrase torque `sC` + ch momentOfInertia `S.denotes` phrase momentOfInertia `S.sAnd` ch angularAccel `S.denotes` + (phrase angularAccel !.), S "This implies"] angularDisplacementDerivSent3 = foldlSentCol [S "And rearranged as" ] diff --git a/code/drasil-example/Drasil/SSP/Assumptions.hs b/code/drasil-example/Drasil/SSP/Assumptions.hs index f7948e9e36..c78bd583fe 100644 --- a/code/drasil-example/Drasil/SSP/Assumptions.hs +++ b/code/drasil-example/Drasil/SSP/Assumptions.hs @@ -52,7 +52,7 @@ monotonicF, slopeS, homogeneousL, isotropicP, linearS, planeS, largeN, waterSIntersect, negligibleSlopeEffect, hydrostaticFMidpoint :: Sentence monotonicF = foldlSent [S "The", phrase slpSrf, - S "is concave with respect to", S "the" +:+. phrase slopeSrf, S "The", + S "is concave" `wrt` S "the" +:+. phrase slopeSrf, S "The", sParen (ch slipDist `sC` ch slipHght) +:+ S "coordinates", S "of a", phrase slpSrf, S "follow a concave up function"] diff --git a/code/drasil-example/Drasil/SWHS/TMods.hs b/code/drasil-example/Drasil/SWHS/TMods.hs index 973f90d56e..aca639611a 100644 --- a/code/drasil-example/Drasil/SWHS/TMods.hs +++ b/code/drasil-example/Drasil/SWHS/TMods.hs @@ -144,8 +144,8 @@ latentHtENotes :: [Sentence] latentHtENotes = map foldlSent [ [ch latentHeat `S.isThe` S "change" `S.sIn` phrase thermalEnergy, sParen (phrase latentHeat +:+ phrase energy)], - [E latHtEEqn `S.isThe` phrase rOfChng `S.sOf` ch latentHeat, - S "with respect to", phrase time, ch tau], + [E latHtEEqn `S.isThe` phrase rOfChng `S.sOf` ch latentHeat `wrt` + phrase time, ch tau], [ch time `S.isThe` phrase time, S "elapsed" `sC` S "as long as the", phrase phaseChange, S "is not complete"], [S "status" `S.the_ofThe'` phrase phaseChange, S "depends on the", diff --git a/code/drasil-utils/Utils/Drasil.hs b/code/drasil-utils/Utils/Drasil.hs index 3d0f812dda..d3d5dccae4 100644 --- a/code/drasil-utils/Utils/Drasil.hs +++ b/code/drasil-utils/Utils/Drasil.hs @@ -20,13 +20,13 @@ module Utils.Drasil ( -- Phrase and_, and_', andRT, compoundNC, compoundNC', compoundNC'', compoundNC''', compoundNCP1, compoundNCPlPh, for, for', of_, of_', - of_'', of__, ofA, ofN_, the, the', the'', with, ofThe', + of_'', of__, ofA, ofN_, the, the', the'', inThe', with, ofThe', -- Sentence --andIts, andThe, fromThe, inThe, isExpctdToHv, isThe, ofGiv, ofGiv', ofThe, the_ofThe, the_ofThe', --sOf, sOfA, sOr, sVersus, sAnd, sAre, sIn, sIs, toThe, sFor, sFor', sFor'', forTT, forTT' -- Concepts insertStringNP, prependStringNP, insertSentNP, prependSentNP, - theNP, theNP', aNP, aNP', ofTheNP, ofTheNP', ofTheNP'', the_ofTheNP, the_ofTheNP', the_ofTheNP'', + theNP, theNP', aNP, aNP', ofTheNP, ofTheNP', ofTheNP'', inTheNP, inTheNP', inTheNP'', the_ofTheNP, the_ofTheNP', the_ofTheNP'', forNP, forNP', forNP'', ofNP, ofNP', ofNP'', ofNP''', withNP, andNP, andNP', andNP'', andNP''' ) where diff --git a/code/drasil-utils/Utils/Drasil/Concepts.hs b/code/drasil-utils/Utils/Drasil/Concepts.hs index dddd834ccc..f20b8ff2e7 100644 --- a/code/drasil-utils/Utils/Drasil/Concepts.hs +++ b/code/drasil-utils/Utils/Drasil/Concepts.hs @@ -1,5 +1,5 @@ module Utils.Drasil.Concepts (insertStringNP, prependStringNP, insertSentNP, prependSentNP, -theNP, theNP', aNP, aNP', ofTheNP, ofTheNP', ofTheNP'', the_ofTheNP, the_ofTheNP', the_ofTheNP'', +theNP, theNP', aNP, aNP', ofTheNP, ofTheNP', ofTheNP'', inTheNP, inTheNP', inTheNP'', the_ofTheNP, the_ofTheNP', the_ofTheNP'', forNP, forNP', forNP'', ofNP, ofNP', ofNP'', ofNP''', withNP, andNP, andNP', andNP'', andNP''' )where import Language.Drasil @@ -47,6 +47,16 @@ ofTheNP' t1 t2 = nounPhrase'' (phraseNP t1 `ofThe` phraseNP t2) (pluralNP t1 `of ofTheNP'' :: (NP -> Sentence) -> (NP -> Sentence) -> NP -> NP -> NP ofTheNP'' f1 f2 t1 t2 = nounPhrase'' (phraseNP t1 `ofThe` phraseNP t2) (f1 t1 `ofThe` f2 t2) CapFirst CapWords +-- | Inserts "in the" between two 'NP's +inTheNP :: NP -> NP -> NP +inTheNP = insertStringNP "in the" +-- | Similar to 'ofTheNP', but the plural case is now @pluralNP t1 `inThe` phraseNP t2@ +inTheNP' :: NP -> NP -> NP +inTheNP' t1 t2 = nounPhrase'' (phraseNP t1 `inThe` phraseNP t2) (pluralNP t1 `inThe` phraseNP t2) CapFirst CapWords +-- | Similar to 'ofTheNP', but accepts two functions for the plural case +inTheNP'' :: (NP -> Sentence) -> (NP -> Sentence) -> NP -> NP -> NP +inTheNP'' f1 f2 t1 t2 = nounPhrase'' (phraseNP t1 `inThe` phraseNP t2) (f1 t1 `inThe` f2 t2) CapFirst CapWords + -- | Prepends "the" and inserts "of the" the_ofTheNP :: NP -> NP -> NP the_ofTheNP t1 t2 = theNP t1 `ofTheNP` t2 diff --git a/code/drasil-utils/Utils/Drasil/Phrase.hs b/code/drasil-utils/Utils/Drasil/Phrase.hs index d1a4ce658c..2ea3ce5db8 100644 --- a/code/drasil-utils/Utils/Drasil/Phrase.hs +++ b/code/drasil-utils/Utils/Drasil/Phrase.hs @@ -134,7 +134,16 @@ the' t = nounPhrase'' (S "the" +:+ titleize t) (S "the" +:+ titleize' t) CapWord -- | A customizable version of 'the' the'' :: (t -> Sentence) -> t -> NP -the'' f t = nounPhrase''(S "the" +:+ f t) (S "the" +:+ f t) CapFirst CapWords +the'' f t = nounPhrase'' (S "the" +:+ f t) (S "the" +:+ f t) CapFirst CapWords + +-- | Creates a noun phrase by combining two 'NamedIdea's with the words "in the" between +-- their terms. Plural is defaulted to @(plural t1) "in the" (phrase t2)@ +inThe' :: (NamedIdea c, NamedIdea d) => c -> d -> NP +inThe' t1 t2 = nounPhrase'' + (phrase t1 +:+ S "in the" +:+ phrase t2) + (plural t1 +:+ S "in the" +:+ phrase t2) + (Replace (atStart t1 +:+ S "in the" +:+ phrase t2)) + (Replace (titleize t1 +:+ S "in the" +:+ titleize t2)) -- | Combinator for combining two 'NamedChunk's into one. -- /Does not preserve abbreviations/ diff --git a/code/drasil-utils/Utils/Drasil/Sentence.hs b/code/drasil-utils/Utils/Drasil/Sentence.hs index 18168ff0bd..45578b6344 100644 --- a/code/drasil-utils/Utils/Drasil/Sentence.hs +++ b/code/drasil-utils/Utils/Drasil/Sentence.hs @@ -1,5 +1,6 @@ module Utils.Drasil.Sentence (andIts, andThe, fromThe, inThe, isExpctdToHv, isThe, ofGiv, forTT, forTT', - ofGiv', ofThe, the_ofThe, the_ofThe', sOf, sOfA, sOr, sVersus, sAnd, sAre, sIn, sIs, toThe, sFor, sFor', sFor'') where + ofGiv', ofThe, the_ofThe, the_ofThe', sOf, sOfA, sOr, sVersus, sAnd, sAre, sIn, sIs, toThe, sFor, sFor', sFor'', + denotes, wrt, defnAs) where import Language.Drasil @@ -12,7 +13,7 @@ sentHelper :: String -> Sentence -> Sentence -> Sentence sentHelper inStr a b = a +:+ S inStr +:+ b andIts, andThe, fromThe, inThe, isExpctdToHv, isThe, ofGiv, ofGiv', ofThe, the_ofThe, the_ofThe', sOf, sOfA, - sOr, sVersus, sAnd, sAre, sIn, sIs, toThe, sFor :: Sentence -> Sentence -> Sentence + sOr, sVersus, sAnd, sAre, sIn, sIs, toThe, sFor, denotes, wrt, defnAs :: Sentence -> Sentence -> Sentence -- | Inserts the words "and its" between two Sentences andIts = sentHelper "and its" @@ -46,6 +47,12 @@ toThe = sentHelper "to the" ofThe = sentHelper "of the" -- | Inserts the word "for" between two Sentences sFor = sentHelper "for" +-- | Inserts the words "denotes the" between two Sentences +denotes = sentHelper "denotes the" +-- | Inserts the words "with respect to" between two Sentences +wrt = sentHelper "with respect to" +-- | Inserts the words "defined as" between two Sentences +defnAs = sentHelper "defined as" -- | Similar to 'sFor', but both terms are 'titleize'd sFor' :: (NamedIdea c, NamedIdea d) => c -> d -> Sentence diff --git a/code/scripts/ci_functions.bash b/code/scripts/ci_functions.bash deleted file mode 100755 index 32ce115367..0000000000 --- a/code/scripts/ci_functions.bash +++ /dev/null @@ -1,55 +0,0 @@ -if [ -z "$LABEL_FILE" ]; then - echo "Missing temp file location." - exit 1 -fi - -if [ -z "$MANAGED_LABEL_FILE" ]; then - echo "Missing managed temp file location." - exit 1 -fi - -if [ -z "$ALL_FUNCTIONS_FILE" ]; then - echo "Missing temp file name to export all loaded bash functions." - exit 1 -fi - -if [ -z "$TRAVIS_CMD" ]; then - echo "Expected script to be running under CI. Stopping." - exit 1 -fi - -ci_export_funcs() { - declare -f > "$ALL_FUNCTIONS_FILE" - echo $(shopt | grep -E "on$" | cut -f1 | sed -E "s/^([^ ]*) *$/-O \1/g") > "$SHELL_OPTS_FILE" -} - -ci_retry () { - # Wraps travis_retry to allow it to retry entire command pipelines. - travis_retry "$SHELL" $(cat "$SHELL_OPTS_FILE") -c "source \"$ALL_FUNCTIONS_FILE\"; $*" -} - -ci_fstep() { - if [ -z "$1" ]; then - echo "Missing label" - return 1 - fi - local label="$1" - - shift 1 - - local fold_id=$(echo "$label" | sed "s/[^A-Za-z_]/_/g") - - travis_fold "start" $fold_id - echo -e "$ANSI_YELLOW$label$ANSI_RESET" - "$SHELL" $(shopt | grep -E "on$" | cut -f1 | sed -E "s/^([^ ]*) *$/-O \1/g") -c "source \"$ALL_FUNCTIONS_FILE\"; $*" - local ret=$? - travis_fold "end" $fold_id - echo -e "$ANSI_CLEAR" - - echo "$label" >> "$MANAGED_LABEL_FILE" - if [ $ret -ne "0" ]; then - echo "$label" >> "$LABEL_FILE" - fi - - return $ret -} \ No newline at end of file diff --git a/code/scripts/deploy.bash b/code/scripts/deploy.bash index 05995d2fd7..db6e7d7b6b 100644 --- a/code/scripts/deploy.bash +++ b/code/scripts/deploy.bash @@ -4,43 +4,25 @@ DEPLOY_FOLDER="deploy/" BUILD_NUMBER_FILE=".build-num" COMMIT_HASH_FILE=".commit-hash" -if [[ "$TRAVIS_EVENT_TYPE" != "cron" && "$TRAVIS_EVENT_TYPE" != "api" ]]; then - echo "Deployment only occurs for cron (or api -- manually run) builds." - exit 0 -fi - -if [ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then - echo "Only perform deploys for $SOURCE_BRANCH." +if [ "$GITHUB_REF" != "refs/heads/$SOURCE_BRANCH" ]; then + echo "Only perform deploys for $SOURCE_BRANCH (attempted on: $GITHUB_REF)." echo "Skipping." exit 0 fi # This check is seemingly redundant, but we want to be certain we're not deploying for the gh-pages branch as # that could cause an infinite recursion. -if [ "$TRAVIS_BRANCH" = "$DEPLOY_BRANCH" ]; then +if [ "$GITHUB_REF" = "refs/heads/$DEPLOY_BRANCH" ]; then echo "Tried to deploy for the deploy target." echo "This should never happen. Something is really off." echo "Failing build." exit 1 fi -if [ -z "$BOT_TOKEN" ]; then - echo "Secure variables unavailable." - echo "Failing build for this." - exit 1 -fi - -if [ -z "$BOT_EMAIL" ]; then - echo "Assuming dummy email" - BOT_EMAIL="drasil-bot@local" -fi - -source "$ALL_FUNCTIONS_FILE" - try_deploy() { # Cleanup the deploy folder if it already exists. rm -rf "$DEPLOY_FOLDER" >/dev/null 2>&1 - git clone --quiet --branch="$DEPLOY_BRANCH" --depth=5 "https://github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOY_FOLDER" + git clone --quiet --branch="$DEPLOY_BRANCH" --depth=5 "https://github.com/$GITHUB_REPOSITORY.git" "$DEPLOY_FOLDER" if [ $? = 1 ]; then echo "Clone failed. Bailing." exit 1 @@ -49,20 +31,20 @@ try_deploy() { cd "$DEPLOY_FOLDER" CLONED_BUILD_NUM=$(cat "$BUILD_NUMBER_FILE") - if [ $CLONED_BUILD_NUM -ge $TRAVIS_BUILD_NUMBER ]; then + if [ "$CLONED_BUILD_NUM" -ge "$GITHUB_RUN_NUMBER" ]; then echo "Deploy is newer than current build. Stopping here." return 0 fi CLONED_HASH=$(cat "$COMMIT_HASH_FILE") - if [ $CLONED_HASH = $TRAVIS_COMMIT ]; then + if [ $CLONED_HASH = $GITHUB_SHA ]; then echo "Deploy would be from same hash as current. Skipping it." return 0 fi - echo $TRAVIS_BUILD_NUMBER > "$BUILD_NUMBER_FILE" - echo $TRAVIS_COMMIT > "$COMMIT_HASH_FILE" + echo $GITHUB_RUN_NUMBER > "$BUILD_NUMBER_FILE" + echo $GITHUB_SHA > "$COMMIT_HASH_FILE" cd "$CUR_DIR" make deploy_lite DEPLOY_FOLDER="$DEPLOY_FOLDER" MAKE_RET=$? @@ -70,20 +52,7 @@ try_deploy() { echo "Making the deploy folder failed! Failing deploy." return $MAKE_RET fi - cd "$DEPLOY_FOLDER" - - git config user.email "$BOT_EMAIL" - git config user.name "drasil-bot" - git add -A . - # We overwrite history because the artifacts we keep in here are moderately large and would pollute history otherwise. - git commit -q --allow-empty -m "drasil-bot deploy of $SOURCE_BRANCH@$TRAVIS_COMMIT" - git push --quiet "https://$BOT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOY_BRANCH" - PUSH_RET=$? - # Perform some cleanup so we can (optionally retry) - cd "$CUR_DIR" - rm -rf "$DEPLOY_FOLDER" - # git push returns >0 if push fails (i.e. we would need to force push) - return $PUSH_RET + return $MAKE_RET } -travis_retry try_deploy +try_deploy diff --git a/code/scripts/maybe_test_deploy.sh b/code/scripts/maybe_test_deploy.sh deleted file mode 100644 index b7ded2d954..0000000000 --- a/code/scripts/maybe_test_deploy.sh +++ /dev/null @@ -1,19 +0,0 @@ -# This script may be a little overzealous in testing deploy (without actually deploying) based on what git diff returns. - -if [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then - echo "Missing TRAVIS_PULL_REQUEST_BRANCH." - exit 0 -fi - -CHANGED_FILES=$(git diff --name-only "$TRAVIS_BRANCH" | grep -E "website/|deploy_stage" | wc -l) -if [ $CHANGED_FILES -gt 0 ]; then - echo "Looks like there were changes to the deploy website." - make deploy_lite - RET=$? - echo "Printing index (in case template splicing went awry)" - cat "website/_site/index.html" - RET=$(( $RET || $? )) - exit $RET -else - echo "No changes to test." -fi diff --git a/code/stable/dblpendulum/SRS/DblPendulum_SRS.tex b/code/stable/dblpendulum/SRS/DblPendulum_SRS.tex index 08b66092e4..4cfe49fac8 100644 --- a/code/stable/dblpendulum/SRS/DblPendulum_SRS.tex +++ b/code/stable/dblpendulum/SRS/DblPendulum_SRS.tex @@ -1056,7 +1056,7 @@ \subsubsection{Instance Models} \begin{displaymath} \mathbf{τ}=\mathbf{I} α \end{displaymath} -Where $\mathbf{τ}$ denotes the torque, $\mathbf{I}$ denotes the moment of inertia and $α$ denotes the angular acceleration This implies: +Where $\mathbf{τ}$ denotes the torque, $\mathbf{I}$ denotes the moment of inertia and $α$ denotes the angular acceleration. This implies: \begin{displaymath} -m \mathbf{g} \sin\left({θ_{p}}\right) {L_{\text{rod}}}=m {L_{\text{rod}}}^{2} \frac{\,d\frac{\,d{θ_{p}}}{\,dt}}{\,dt} diff --git a/code/stable/dblpendulum/Website/DblPendulum_SRS.html b/code/stable/dblpendulum/Website/DblPendulum_SRS.html index 2d8ee8efe0..095899074d 100644 --- a/code/stable/dblpendulum/Website/DblPendulum_SRS.html +++ b/code/stable/dblpendulum/Website/DblPendulum_SRS.html @@ -1545,7 +1545,7 @@

Detailed derivation of angular displacement:

\[\mathbf{τ}=\mathbf{I} α\]

- Where τ denotes the torque, I denotes the moment of inertia and α denotes the angular acceleration This implies: + Where τ denotes the torque, I denotes the moment of inertia and α denotes the angular acceleration. This implies:

\[-m \mathbf{g} \sin\left({θ_{p}}\right) {L_{\text{rod}}}=m {L_{\text{rod}}}^{2} \frac{\,d\frac{\,d{θ_{p}}}{\,dt}}{\,dt}\]

And rearranged as:

diff --git a/code/website/Main.hs b/code/website/Main.hs index 4bfc8ac6ab..3bfbc96695 100644 --- a/code/website/Main.hs +++ b/code/website/Main.hs @@ -182,16 +182,16 @@ main = do -- Env variables relating to variables exposed on CI. -- Because we want to be able to test site building locally, we fill in these stubs with -- (sometimes correct) assumptions. - travisRepoSlug <- fromMaybe "JacquesCarette/Drasil" <$> lookupEnv "TRAVIS_REPO_SLUG" - travisCommit <- fromMaybe "master" <$> lookupEnv "TRAVIS_COMMIT" + repoSlug <- fromMaybe "JacquesCarette/Drasil" <$> lookupEnv "GITHUB_REPOSITORY" + commit <- fromMaybe "master" <$> lookupEnv "GITHUB_SHA" -- Next two are metadata used to produce the footer. - travisBuildNumber <- fromMaybe "0" <$> lookupEnv "TRAVIS_BUILD_NUMBER" - travisBuildId <- lookupEnv "TRAVIS_BUILD_ID" + buildNumber <- fromMaybe "0" <$> lookupEnv "GITHUB_RUN_NUMBER" + buildId <- lookupEnv "GITHUB_RUN_ID" - let repoCommitRoot = "https://github.com/" ++ travisRepoSlug ++ "/tree/" ++ travisCommit ++ "/" + let repoCommitRoot = "https://github.com/" ++ repoSlug ++ "/tree/" ++ commit ++ "/" let docsPath = docsRoot ++ "index.html" - let travisBuildPath = "https://travis-ci.com/" ++ travisRepoSlug ++ maybe "" ("/builds/" ++) travisBuildId + let buildPath = "https://github.com/" ++ repoSlug ++ "/actions" ++ maybe "" ("/runs/" ++) buildId doesDocsExist <- doesFileExist $ deployLocation ++ docsPath examples <- mkExamples repoCommitRoot (deployLocation ++ exampleRoot) srsDir @@ -215,9 +215,9 @@ main = do let indexCtx = listField "examples" (mkExampleCtx exampleRoot srsDir doxDir) (mapM makeItem examples) <> listField "graphs" (mkGraphCtx graphRoot) (mapM makeItem graphs) <> (if doesDocsExist then field "docsUrl" (return . const docsPath) else mempty) <> - field "buildNumber" (return . const travisBuildNumber) <> - field "buildUrl" (return . const travisBuildPath) <> - field "commit" (return . const travisCommit) <> + field "buildNumber" (return . const buildNumber) <> + field "buildUrl" (return . const buildPath) <> + field "commit" (return . const commit) <> field "commitUrl" (return . const repoCommitRoot) <> defaultContext diff --git a/code/website/Makefile b/code/website/Makefile index 0b4b2a1d6a..317b451693 100644 --- a/code/website/Makefile +++ b/code/website/Makefile @@ -4,7 +4,7 @@ build: stack build --ghc-options="-Wall" website run: build - stack exec -- site rebuild + stack exec -- website rebuild clean: -rm -r _site diff --git a/code/website/StringUtils.hs b/code/website/StringUtils.hs index 8f65ca3b29..c26eaa38d2 100644 --- a/code/website/StringUtils.hs +++ b/code/website/StringUtils.hs @@ -8,8 +8,8 @@ strip :: String -> String strip = rstrip . lstrip lstrip :: String -> String -lstrip (c:cs) | c `elem` " \t\r\n" = lstrip cs - | otherwise = cs +lstrip it@(c:cs) | c `elem` " \t\r\n" = lstrip cs + | otherwise = it lstrip [] = "" rstrip :: String -> String diff --git a/code/website/package.yaml b/code/website/package.yaml index 02adfa68b1..6108276a7d 100644 --- a/code/website/package.yaml +++ b/code/website/package.yaml @@ -1,10 +1,10 @@ -name: website -version: 0.1.0.0 -maintainer: "Jacques Carette" -synopsis: A framework for code and document generation for scientific software - Utils SubPackage -github: JacquesCarette/Drasil -homepage: https://jacquescarette.github.io/Drasil/ -description: Please see the README on GitHub at +name: website +version: 0.1.0.0 +maintainer: "Jacques Carette" +synopsis: A framework for code and document generation for scientific software - Utils SubPackage +github: JacquesCarette/Drasil +homepage: https://jacquescarette.github.io/Drasil/ +description: Please see the README on GitHub at extra-source-files: []