Skip to content

Commit

Permalink
docs(website): switch from orchid to hugo (#1049)
Browse files Browse the repository at this point in the history
* Orchid seems to be facing issues with maintenance. The [last update](https://orchid.run/news/2021-5-13/whats-up-with-orchid) was on May 2021, and the deadlines there have not been met. Most notably, there is still no support for recent Java, nor a release on Central (orchidhq/Orchid#393). Hugo, although less integrated with Gradle, seems way more solid. I mourn the possibility to write templates in Pebble + Kotlin, the language for Hugo shortcodes is not even closely comparable.
* The CI now checks for dangling links, except in Dokka-generated documents, as they are **WAY** too buggy, see Kotlin/dokka#2320, Kotlin/dokka#2321, Kotlin/dokka#2322, and Kotlin/dokka#2323, that I opened before giving up on checking link integrity.
* The update comes with some internal refactoring to the classes defining the YAML syntax elements.
  • Loading branch information
DanySK authored Jan 24, 2022
1 parent 1294343 commit 683c92b
Show file tree
Hide file tree
Showing 181 changed files with 4,033 additions and 5,050 deletions.
79 changes: 32 additions & 47 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,73 +27,58 @@ jobs:
steps:
- name: Checkout
uses: danysk/[email protected]
- name: Checkout the docs
if: contains(github.repository, 'AlchemistSimulator/Alchemist')
uses: actions/[email protected]
with:
path: build/website
fetch-depth: 0
persist-credentials: true
repository: AlchemistSimulator/alchemistsimulator.github.io
submodules: recursive
token: ${{ secrets.DEPLOYMENT_TOKEN }}
- name: Cleanup the old website
shell: bash
run: |
rm -rf build/website/*
ls -ahl build/website
- name: Get branch name
id: branch
uses: tj-actions/branch-names@v5
- uses: DanySK/[email protected]
with:
build-command: |
./gradlew assemble shadowJar --parallel
./gradlew assemble shadowJar --parallel || ./gradlew assemble shadowJar --parallel
if [ '${{ matrix.os }}' == 'ubuntu' ]; then
./gradlew hugoBuild --parallel
fi
check-command: |
./gradlew check --parallel || ./gradlew check --parallel
if [ '${{ matrix.os }}' == 'ubuntu' ]; then
# Temporarily disable checks on kdoc/javadoc: too many bugs in Dokka.
# See:
# https://github.com/Kotlin/dokka/issues/2320
# https://github.com/Kotlin/dokka/issues/2321
# https://github.com/Kotlin/dokka/issues/2322
# https://github.com/Kotlin/dokka/issues/2323
# Once everything gets fixed, lychee could simply run on '/lychee/**/*.html'
FILES="$(find build/website/ -name '*.html' | grep -v /kdoc/ | grep -v /javadoc/ | sed -e 's#^build##')"
docker run --rm -v "$(pwd)/build/website:/website" -e GITHUB_TOKEN lycheeverse/lychee $(echo "$FILES") --exclude-file /website/lycheeignore -m 100 --threads 1
fi
clean-command: |
./gradlew clean --parallel
deploy-command: |
./gradlew signKotlinMavenPublication --parallel
./gradlew closeKotlinMavenOnMavenCentralNexus
npm install
npx semantic-release
should-run-codecov: ${{ contains('Linux', runner.os) }}
should-deploy: >-
${{
contains('Linux', runner.os)
&& contains(github.repository, 'AlchemistSimulator/Alchemist')
&& contains('push workflow_dispatch', github.event_name)
}}
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
build-website:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: danysk/[email protected]
- uses: DanySK/[email protected]
with:
java-version: 11
build-command: ./gradlew orchidBuild --parallel
check-command: true
should-run-codecov: false
should-deploy: >-
${{
contains(github.repository, 'AlchemistSimulator/Alchemist')
&& contains('push workflow_dispatch', github.event_name)
}}
deploy-command: ./gradlew orchidDeploy --parallel
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
Release:
needs:
- build
- build-website
runs-on: ubuntu-latest
if: >-
contains('push workflow_dispatch', github.event_name)
&& contains(github.repository, 'AlchemistSimulator/Alchemist')
steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.DEPLOYMENT_TOKEN }}
- uses: DanySK/[email protected]
with:
java-version: 11
build-command: true
check-command: true
deploy-command: |
npm install
npx semantic-release
should-run-codecov: false
should-deploy: true
should-validate-wrapper: false
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/main/hugo/themes/hugo-theme-relearn"]
path = src/main/hugo/themes/hugo-theme-relearn
url = [email protected]:McShelby/hugo-theme-relearn.git
6 changes: 3 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Alchemist is Copyright (C) 2010-2019, Danilo Pianini and contributors listed in the pom.xml file available for each
Alchemist is Copyright (C) 2010-2019, Danilo Pianini and contributors listed in the `pom.xml` file available for each
module from "The Central Repository", reachable from http://search.maven.org/.

Alchemist is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand All @@ -8,7 +8,7 @@ documentation is licensed under the [Creative Commons Attribution 3.0 License](h
Alchemist is distributed in the hope that it will be useful, but **WITHOUT ANY WARRANTY**; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Alchemist; see the file GPLv3.txt. If
You should have received a copy of the GNU General Public License along with Alchemist; see the file `GPLv3.txt`. If
not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Compiling or linking this code statically or dynamically with other modules is making a combined work based on this
Expand All @@ -23,4 +23,4 @@ you are not obligated to do so. If you do not wish to do so, delete this except

Over and above the legal restrictions imposed by this license, if you use this software for an academic publication then
you are obliged to provide proper attribution. This should be to the paper that describes this simulator, described in
the CITATION file that comes with this software distribution.
the `CITATION` file that comes with this software distribution.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractCognitiveCharacteristic : CognitiveCharacteristic {

/**
* Cognitive characteristics are modeled following the principles of
* [Network Oriented Modeling](https://doi. org/10.1007/978-3-662-58611-2_2), which allows
* [Network Oriented Modeling](https://doi.org/10.1007/978-3-662-58611-2_2), which allow
* characteristics to influence each other and evolve during the simulation. Each characteristic
* is modeled as an equation; weights and constant values used in equations are defined below.
* These are described in the [IMPACT model](https://doi.org/10.1007/978-3-319-70647-4_11).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package it.unibo.alchemist.model.cognitiveagents.impact.cognitive.utils
import kotlin.math.pow

/**
* https://en.wikipedia.org/wiki/Logistic_function
* [Logistic function](https://en.wikipedia.org/wiki/Logistic_function).
*
* @param sigma Steepness parameter of the logistic function.
* @param tau Threshold parameter of the logistic function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ open class Exploring<T, L : Euclidean2DConvexShape, R>(

/**
* Assigns a weight to a visible door (= passage). This weighting system is derived from the one
* by [Andresen et al.](https://doi.org/10.1080/23249935.2018.1432717). By default, it comprises
* by [Andresen et al.](https://doi.org/10.1080/23249935.2018.1432717/). By default, it comprises
* three factors: [volatileMemoryFactor], [congestionFactor] and [impasseFactor].
*/
protected open fun weight(door: Euclidean2DPassage): Double = door.head.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ open class Continuous2DEnvironment<T>(incarnation: Incarnation<T, Euclidean2DPos
}

/**
* [node].[canFit] must be true for the returned position. For a better understanding of how to compute collision
* points with circular hitboxes see [this discussion](https://bit.ly/3f00NvJ).
* [node].[canFit] must be true for the returned position.
*/
override fun farthestPositionReachable(
node: NodeWithShape<T, *, *>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,38 @@ import it.unibo.alchemist.model.interfaces.geometry.Vector2D
* The requirement is not explicitly enforced to allow the class to work covariantly.
*/
sealed class Intersection2D<out V> {

/**
* List of intersection points (in case of infinite points this is empty).
*/
open val asList: List<V> = emptyList()

/**
* Objects do not intersect.
*/
object None : Intersection2D<Nothing>()

/**
* Objects intersect in a single [point].
*/
data class SinglePoint<P : Vector2D<P>>(val point: P) : Intersection2D<P>() {
override val asList = listOf(point)
}

/**
* Objects intersect in a discrete number of [points].
*/
data class MultiplePoints<P : Vector2D<P>>(val points: List<P>) : Intersection2D<P>() {
override val asList: List<P> get() = points
}

/**
* Objects intersect in infinite points (e.g. overlapping segments).
*/
object InfinitePoints : Intersection2D<Nothing>()

companion object {

/**
* @returns the correct intersection object depending of the number of items in the list.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public double nextRandomDouble() {

/**
* An {@link ExecutionEnvironment} that can read and shadow the content of a
* {@link Node}, but cannot modify it. This is used to prevent badly written
* Node, but cannot modify it. This is used to prevent badly written
* properties to interact with the simulation flow.
*/
public static final class ProtectedExecutionEnvironment implements ExecutionEnvironment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public GeometricVariable(final double def, final double min, final double max, f
}
if (min <= 0d || max <= 0) {
throw new IllegalArgumentException(
"Both minimum and maximum must be bigger than 0 for a geometric variable to work."
"Both minimum and maximum must be bigger than 0 for a geometric variable to work."
);
}
if (samples <= 0) {
throw new IllegalArgumentException("At least one sample is required.");
}
if (min == max && samples != 1) {
throw new IllegalArgumentException(
"Only a single sample can be produced if min and max are exactly equal. (min="
"Only a single sample can be produced if min and max are exactly equal. (min="
+ min + ", max=" + max + ", samples=" + samples
);
}
Expand All @@ -69,8 +69,8 @@ public Double getDefault() {
@Override
public Stream<Double> stream() {
return IntStream.range(0, maxSamples)
.mapToDouble(s -> min * FastMath.pow(max / min, (double) s / Math.max(1, maxSamples - 1)))
.boxed();
.mapToDouble(s -> min * FastMath.pow(max / min, (double) s / Math.max(1, maxSamples - 1)))
.boxed();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import it.unibo.alchemist.model.interfaces.Position
import org.apache.commons.math3.random.RandomGenerator

/**
* A deployment based on a [GraphStream](https://graphstream-project.org/) graph.
* A deployment based on a [GraphStream](https://graphstream-project.org) graph.
*/
class GraphStreamDeployment<P>(
private val createLinks: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import it.unibo.alchemist.model.interfaces.Reaction
import org.apache.commons.math3.random.RandomGenerator
import org.danilopianini.jirf.Factory
import it.unibo.alchemist.loader.m2m.LoadingSystemLogger.logger
import it.unibo.alchemist.loader.m2m.syntax.DocumentRoot
import java.lang.IllegalStateException
import java.util.concurrent.Semaphore
import java.util.function.Predicate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import it.unibo.alchemist.loader.export.extractors.MoleculeReader
import it.unibo.alchemist.loader.export.extractors.Time

import it.unibo.alchemist.loader.export.filters.CommonFilters
import it.unibo.alchemist.loader.m2m.DocumentRoot.JavaType
import it.unibo.alchemist.loader.m2m.syntax.DocumentRoot.JavaType
import it.unibo.alchemist.loader.m2m.LoadingSystemLogger.logger
import it.unibo.alchemist.loader.m2m.syntax.DocumentRoot
import it.unibo.alchemist.loader.m2m.syntax.SyntaxElement
import it.unibo.alchemist.loader.shapes.Shape
import it.unibo.alchemist.loader.variables.Constant
import it.unibo.alchemist.loader.variables.DependentVariable
Expand All @@ -45,8 +47,8 @@ import it.unibo.alchemist.model.interfaces.TimeDistribution
import org.apache.commons.math3.random.MersenneTwister
import org.apache.commons.math3.random.RandomGenerator
import kotlin.reflect.KClass
import it.unibo.alchemist.loader.m2m.DocumentRoot.Deployment.Program as ProgramSyntax
import it.unibo.alchemist.loader.m2m.DocumentRoot.Layer as LayerSyntax
import it.unibo.alchemist.loader.m2m.syntax.DocumentRoot.Deployment.Program as ProgramSyntax
import it.unibo.alchemist.loader.m2m.syntax.DocumentRoot.Layer as LayerSyntax

/**
* Contains the model-to-model translation between the Alchemist YAML specification and the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2010-2022, Danilo Pianini and contributors
* listed, for each module, in the respective subproject's build.gradle.kts file.
*
* This file is part of Alchemist, and is distributed under the terms of the
* GNU General Public License, with a linking exception,
* as described in the file LICENSE in the Alchemist distribution's top directory.
*/

package it.unibo.alchemist.loader.m2m.syntax

@Suppress("SuspiciousCollectionReassignment")
internal class DescriptorBuilder {
private var forbiddenKeys = emptySet<String>()
private var mandatoryKeys = emptySet<String>()
private var optionalKeys = emptySet<String>()
fun forbidden(vararg names: String) {
forbiddenKeys += names.toSet()
}
fun mandatory(vararg names: String) {
mandatoryKeys += names.toSet()
}
fun optional(vararg names: String) {
optionalKeys += names.toSet()
}
fun build() = SyntaxElement.ValidDescriptor(mandatoryKeys, optionalKeys, forbiddenKeys)
}
Loading

0 comments on commit 683c92b

Please sign in to comment.