Compare commits

...

11 Commits

Author SHA1 Message Date
Martin Scheidt 10d81eb8e7 enhanced release action 2022-06-05 21:49:42 +02:00
Martin Scheidt 8c3803794a updated version 2022-06-05 21:49:10 +02:00
github-actions[bot] 5b378d721e
Set version to 1.0.1 2022-06-05 16:57:14 +00:00
github-actions[bot] bae9390f7d
Set version to 1.0.0 2022-06-05 16:50:18 +00:00
Martin Scheidt a7f07283a1 updated minimal working example in README.md 2022-06-05 18:14:25 +02:00
Martin Scheidt fbdf7bed8f added cff validation 2022-06-05 18:01:41 +02:00
Martin Scheidt 08e7fb6acd remove automated jl doc testing 2022-06-05 17:57:48 +02:00
Martin Scheidt b07d9ec5ff prepared release 2022-06-05 17:41:12 +02:00
Martin Scheidt d184adca8e updated Github Actions 2022-06-05 17:40:57 +02:00
Martin Scheidt e5c08d1410
Merge pull request #16 from railtoolkit/development
Merged PR #14 and PR #15 in new PR
2022-06-05 15:52:36 +02:00
Max Kannenberg 46ac99d2ad
Merge pull request #13 from railtoolkit/development
bumped version
2022-05-30 10:34:48 +02:00
10 changed files with 293 additions and 27 deletions

View File

@ -1,10 +1,29 @@
name: CI
name: "continuous integration test"
on:
push:
branches:
- main
tags: '*'
paths-ignore:
- 'CITATION.cff'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- '.github/workflows/cffvalidation.yml'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
pull_request:
paths-ignore:
- 'CITATION.cff'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- '.github/workflows/cffvalidation.yml'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.

25
.github/workflows/cffvalidation.yml vendored Normal file
View File

@ -0,0 +1,25 @@
### github action to publish a new CITATION.cff
##
name: "cff validation"
## Controls when the workflow will run
on:
push:
paths:
- CITATION.cff
## Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
validate:
name: "validate"
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v3
- name: Validate a CITATION.cff from a subdirectory
uses: citation-file-format/cffconvert-github-action@2.0.0
with:
args: "--infile ./CITATION.cff --validate"

View File

@ -1,14 +0,0 @@
name: Register Package
on:
workflow_dispatch:
inputs:
version:
description: Version to register or component to bump
required: true
jobs:
register:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}

189
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,189 @@
name: create new release
on:
workflow_dispatch:
inputs:
version:
description: Version to register or component to bump
required: true
jobs:
create_package:
name: "create package"
runs-on: ubuntu-latest
steps:
# 1. checkout the repo
- name: "checkout"
uses: actions/checkout@v3
# 2. create release notes
- name: "create release notes"
run: |
VERSION=${{ github.event.inputs.version }}
STATUS=0
grep -qs "Version \[$VERSION\]" CHANGELOG.md || STATUS=1
if [ $STATUS = 1 ]; then
echo "Version $VERSION is not present in CHANGELOG.md."
exit 1
fi
TOP=$(grep -n "Version \[$VERSION\]" CHANGELOG.md | cut -d: -f1)
awk "NR>$TOP" CHANGELOG.md > release-note.tmp.md
BOTTOM=$(grep -n -m 1 "## Version\|[Unreleased]:" release-note.tmp.md | cut -d: -f1)
BOTTOM=$(( $TOP + $BOTTOM ))
BOTTOM=$(( $BOTTOM - 2 ))
TOP=$(( $TOP + 1 ))
awk "NR>$TOP&&NR<$BOTTOM" CHANGELOG.md > release-note-$VERSION.md
sed -i -- "s/###/##/g" release-note-v$VERSION.md
rm release-note.tmp.md
# 3. Update metadata.json
- name: "Update metadata.json"
run: |
VERSION=${{ github.event.inputs.version }}
sed -i".backup" -e"s/\"version\": \"%%\[SCRIPT\]\"/\"version\": \"$VERSION\"/g" .github/zenodo/metadata.json
# 4. create release archive
- uses: papeloto/action-zip@v1
with:
files: docs src test README.md LICENSE Project.toml
recursive: false
dest: TrainRuns.jl-v${{ github.event.inputs.version }}.zip
# 5. upload artifact to share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: |
release-note-${{ github.event.inputs.version }}.md
TrainRuns.jl-v${{ github.event.inputs.version }}.zip
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/zenodo/metadata.json
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
register:
needs: create_package
name: "publish in JuliaRegistries"
runs-on: ubuntu-latest
steps:
# 1. register new release at JuliaRegistries
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
publish_github:
needs: create_package
name: "publish on github"
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/
- uses: actions/download-artifact@v3
# 2. creating a new release
- name: "create release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: artifact/release-note-v${{ github.event.inputs.version }}.md
draft: false
prerelease: false
# 3. upload package to new release
- name: "upload release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/TrainRuns.jl-v${{ github.event.inputs.version }}.zip
asset_name: TrainRuns.jl-v${{ github.event.inputs.version }}.zip
asset_content_type: application/zip
# 4. publish release on github
- name: "publish release"
uses: StuYarrow/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.create_release.outputs.id }}
publish_zenodo:
needs: create_package
name: "publish on zenodo"
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/ and move it one level up
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/TrainRuns.jl-v${{ github.event.inputs.version }}.zip ./
# 2. install zenodraft
- name: "install zenodraft"
run: npm install -g zenodraft
# 3. upload new release to zenodo
- name: "uploading to zenodo"
id: zenodraft
env:
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
COLLECTION: 6448563
run: |
ID=$(zenodraft deposition create version $COLLECTION)
zenodraft file add $ID TrainRuns.jl-v*.zip
zenodraft metadata update $ID artifact/metadata.json
zenodraft deposition publish $ID
echo "::set-output name=doi::$(zenodraft deposition show prereserved $ID)"
update_citation:
needs: [create_package, publish_zenodo]
name: "updating CITATION.cff"
runs-on: ubuntu-latest
steps:
# 1. checkout the repo
- name: "checkout"
uses: actions/checkout@v3
# 2. update CITATION.cff
- run: |
DATE=$(date "+%Y-%m-%d")
VERSION=${{ github.event.inputs.version }}
DOI=${{needs.publish_zenodo.outputs.doi}}
echo "find lines in CITATION.cff"
VERSION_LINE=$(grep -n 'version: [0-9][0-9][0-9][0-9].[0-1][0-9]' CITATION.cff | cut -d: -f1)
DATE_LINE=$(grep -n 'date-released:' CITATION.cff | cut -d: -f1)
echo "select the second DOI"
DOI_LINE=$(grep -n 'type: doi' CITATION.cff | cut -d: -f1 | awk "NR==2")
DOI_LINE=$(( $DOI_LINE + 1 ))
echo "update CITATION.cff"
sed -i -- "${VERSION_LINE}s|.*|version: $VERSION|" CITATION.cff
sed -i -- "${DATE_LINE}s|.*|date-released: ${DATE}|" CITATION.cff
sed -i -- "${DOI_LINE}s|.*| value: $DOI|" CITATION.cff
# 3. push the change back to main
- name: push
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "DOI updated to ${{needs.create_package.outputs.version}} (via github action)"
branch: main
file_pattern: CITATION.cff
commit_user_name: railtoolkit
commit_user_email: railtoolkit@ownx.net
publish_twitter:
needs: [create_package, publish_zenodo]
name: "tweet about it"
runs-on: ubuntu-latest
steps:
- uses: devigned/go-twitter-action@v1
with:
message: "The new version ${{ github.event.inputs.version }} of TrainRuns.jl is available! DOI: https://doi.org/${{needs.publish_zenodo.outputs.doi}}"
apiKey: ${{ secrets.TWITTER_API_KEY }}
apiKeySecret: ${{ secrets.TWITTER_API_SECRET }}
accessToken: ${{ secrets.TWITTER_ACCESS_TOKEN }}
accessTokenSecret: ${{ secrets.TWITTER_ACCESS_SECRET }}

33
.github/zenodo/metadata.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
"title": "TrainRuns.jl",
"version": "%%[SCRIPT]",
"creators": [
{
"affiliation": "TU Braunschweig",
"name": "Kannenberg, Max"
},
{
"orcid": "0000-0002-9384-8945",
"affiliation": "TU Braunschweig",
"name": "Scheidt, Martin"
}
],
"description": "TrainRun.jl is a step towards open science and open data in railway engineering. Its modular design offers the possibility to serve as a basis for future optimization and development. TrainRun.jl is suitable for qualitative calculations to compare different trains, and it is publicly available, and we invite others to collaborate.",
"keywords": [
"railway",
"running time",
"driving dynamics",
"julia language"
],
"license": {
"id": "ISC"
},
"language": "eng",
"access_right": "open",
"upload_type": "software",
"communities": [
{
"identifier": "railtoolkit"
}
]
}

View File

@ -9,12 +9,23 @@ Categories: Added, Changed, Deprecated, Removed, Fixed, and Security.
## [Unreleased]
## Version [1.0.1] 2022-06-05
* automated Julia package registration
## Version [1.0.0] 2022-06-05
### Added
* dependency JSONSchema
* validation of YAML input via JSON schema
* labels for Points Of Interests
* DataFrame as output format
### Changed
* renamed TrainRun into TrainRuns
* unified ouput format
* replaced settings::Dict with type Settings as struct
* replaced path::Dict with type Path as struct
* replaced train::Dict with type Train as struct
@ -43,6 +54,7 @@ Categories: Added, Changed, Deprecated, Removed, Fixed, and Security.
* dependency Plots and CSV
* AdditionalOutput.jl
* EnergySaving.jl
* energy calculation
* test/testEnums.jl
* import.jl
* export.jl
@ -180,7 +192,9 @@ Modules and variables were renamed.
Proof of concept and master thesis submission.
[Unreleased]: https://github.com/railtoolkit/TrainRuns.jl/compare/v0.8...main
[Unreleased]: https://github.com/railtoolkit/TrainRuns.jl/compare/v1.0.1...main
[1.0.1]: https://github.com/railtoolkit/TrainRuns.jl/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/railtoolkit/TrainRuns.jl/compare/v0.8...v1.0.0
[0.8]: https://github.com/railtoolkit/TrainRuns.jl/compare/v0.7...v0.8
[0.7]: https://github.com/railtoolkit/TrainRuns.jl/compare/v0.6.2...v0.7
[0.6.2]: https://github.com/railtoolkit/TrainRuns.jl/compare/v0.6.1...v0.6.2

View File

@ -20,7 +20,7 @@ identifiers:
value: 10.5281/zenodo.6448563
description: 'Collection of archived snapshots of all versions of the library'
- type: doi
value: 10.5281/zenodo.6448564
value: 10.5281/zenodo.6615424
description: Current version
url: 'https://www.railtoolkit.org/projects/TrainRuns.jl/'
repository: 'https://github.com/railtoolkit/TrainRuns.jl'
@ -36,5 +36,5 @@ keywords:
- driving dynamics
- julia language
license: ISC
version: v0.8
date-released: 2022-01-20
version: v1.0.1
date-released: 2022-06-05

View File

@ -1,7 +1,7 @@
name = "TrainRuns"
uuid = "e4541106-d44c-4e00-b50b-ecdf479fcf92"
authors = ["Max Kannenberg", "Martin Scheidt", "contributors"]
version = "1.0.0"
version = "1.0.1"
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

View File

@ -32,10 +32,10 @@ The required julia packages are
```julia
using TrainRuns
train = Train("test/data/trains/freight.yaml")
path = Path("test/data/paths/const.yaml")
train = Train("train.yaml") # load train from file
path = Path("path.yaml") # load running path from file
runtime = trainrun(train, path)
runtime = trainrun(train, path)[end,:t]
println("The train needs $runtime seconds for the running path.")
```

View File

@ -12,7 +12,7 @@ The function Settings() will create a set of settings for the train run calculat
`file` is optinal may be used to load settings in the YAML format.
# Example
```jldoctest
```
julia> my_settings = Settings() # will generate default settings
Settings(mass_point, :distance, 20, 3, running_time, :dataframe)
```
@ -92,7 +92,7 @@ The function Path() will create a running path for the train.
Supported formats are: railtoolkit/schema (2022.05)
# Example
```jldoctest
```
julia> my_path = Path("file.yaml") # will generate a path from a YAML file.
Path(variables)
```
@ -277,7 +277,7 @@ The function Train() will create a train to use in calculations.
Supported formats for the YAML files are: railtoolkit/schema (2022.05)
# Example
```jldoctest
```
julia> my_train = Train("file.yaml") # will generate a train from a YAML file.
Train(variables)
```