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

Release 1.0.0 #328

Merged
merged 7 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Report a bug or issue
title: ''
labels: ''
assignees: ''

---

**NOTE:** this issue system is intended for reporting bugs and tracking progress in software
development.


## Expected behavior

## Observed behavior

## Version of lamassu used (exact commit hash or JAR name)

## Data sets in use (links to GBFS feeds)

## Command line used to start lamassu

## Configuration used

## Steps to reproduce the problem
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest a feature or improvement for lamassu
title: ''
labels: new feature
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Goal / high level use-case**
<!-- Describe the the goal, high level use-case this is is part of. -->

**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
62 changes: 62 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## PR Instructions

When creating a pull request, please follow the format below. For each section, *replace* the
guidance text with your own text, keeping the section heading. If you have nothing to say in a
particular section, you can completely delete the section including its heading to indicate that you
have taken the requested steps. None of these instructions or the guidance text (non-heading text)
should be present in the submitted PR. These sections serve as a checklist: when you have replaced
or deleted all of them, the PR is considered complete.

### Summary

Explain in one or two sentences what this PR achieves.

### Issue

Link to or create an [issue](https://github.com/entur/lamassu/issues) that
describes the relevant feature or bug. You need not create an issue for small bugfixes and code
cleanups, but in that case do describe the problem clearly and completely in the "summary" section
above. In the linked issue (or summary section for smaller PRs) please describe:

- Motivation (problem or need encountered)
- How the code works
- Technical approach and any design considerations or decisions

Remember that the PR will be reviewed by another developer who may not be familiar with your use
cases or the code you're modifying. It generally takes much less effort for the author of a PR to
explain the background and technical details than for a reviewer to infer or deduce them. PRs may be
closed if they or their linked issues do not contain sufficient information for a reviewer to
proceed.

Add [GitHub keywords](https://help.github.com/articles/closing-issues-using-keywords/) to this PR's
description, for example:

Closes #45

### Unit tests

Write a few words on how the new code is tested.

- Were unit tests added/updated?
- Was any manual verification done?
- Any observations on changes to performance?
- Was the code designed so it is unit testable?
- Were any tests applied to the smallest appropriate unit?

### Documentation

- Have you added documentation in code covering design and rationale behind the code?
- Were all non-trivial public classes and methods documented with Javadoc?
- Were any new configuration options added?

### Changelog

The [changelog file](https://github.com/entur/lamassu/blob/master/Changelog.md)
is generated from the pull-request title, make sure the title describe the feature or issue fixed.
To exclude the PR from the changelog add the label `skip changelog` to the PR.

### Bumping the serialization version id

If you have made changes to the way the routing graph is serialized, for example by renaming a field
in one of the edges, then you must add the label `bump serialization id` to the PR. With this label
Github Actions will increase the field `lamassu.serialization.version.id` in `pom.xml`.
66 changes: 66 additions & 0 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Post-merge
on:
pull_request_target:
branches:
- master
types: [closed]

jobs:
changelog-entry:
if: github.event.pull_request.merged && github.repository_owner == 'entur' && !contains(github.event.pull_request.labels.*.name, 'skip changelog')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate changelog entry from PR information
run: |
# add a line above the one which contains AUTOMATIC_CHANGELOG_PLACEHOLDER
ITEM="${TITLE} [#${NUMBER}](${URL})"
TEMP_FILE=Changelog.generated.md
FILE=Changelog.md
awk "/CHANGELOG_PLACEHOLDER/{print \"- $ITEM\"}1" $FILE > $TEMP_FILE
mv $TEMP_FILE $FILE
git add $FILE
git commit -m "Add changelog entry for #${NUMBER} [ci skip]"
git pull --rebase origin master
git push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git HEAD:master
env:
# Use environment variables to prevent injection attack
TITLE: ${{ github.event.pull_request.title }}
NUMBER: ${{ github.event.pull_request.number }}
URL: ${{ github.event.pull_request.html_url }}

serialization-version:
# if you have a dependent job that is skipped (i.e. you want to bump the version but not have a changelog entry) you must add
# always() before your actual condition you want for the job
# https://github.com/actions/runner/issues/491#issuecomment-660122693
if: always() && github.event.pull_request.merged && github.repository_owner == 'entur' && contains(github.event.pull_request.labels.*.name, 'bump serialization id')
runs-on: ubuntu-latest
needs: [changelog-entry]
permissions:
contents: write
steps:
- name: Install xmllint
run: |
sudo apt-get install -y libxml2-utils
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump serialization version
run: |
version=`xmllint --xpath "//*[local-name()='lamassu.serialization.version.id']/text()" pom.xml`
bumped=$((version+1))
sed -Ei "s/<lamassu\.serialization\.version\.id>.*<\/lamassu\.serialization\.version\.id>/<lamassu\.serialization\.version\.id>${bumped}<\/lamassu\.serialization\.version\.id>/" pom.xml
git add pom.xml
git commit -m "Bump serialization version id for #${NUMBER}"
# just for safety as the Github repo is eventually consistent, therefore this push competes with the changelog entry one
git pull --rebase origin master
git push ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git HEAD:master
env:
# Use environment variables to prevent injection attack
NUMBER: ${{ github.event.pull_request.number }}
12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

The changelog lists most feature changes between each release. The list is automatically created
based on merged pull requests. Search GitHub issues and pull requests for smaller issues.

## 1.1.0 (under development)

[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 1.0.0

First major release
21 changes: 20 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
</parent>
<groupId>org.entur</groupId>
<artifactId>lamassu</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>lamassu</name>
<description>Micro mobility aggregation</description>

<properties>
<lamassu.serialization.version.id>18</lamassu.serialization.version.id>

<java.version>21</java.version>

<graphql-starter.version>15.1.0</graphql-starter.version>
Expand Down Expand Up @@ -208,6 +210,15 @@
</dependencies>

<build>
<!--
Filtering will perform substitution on lamassu-project-info.properties,
-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand All @@ -233,6 +244,14 @@
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<propertiesEncoding>UTF-8</propertiesEncoding>
</configuration>
</plugin>
<plugin>
<groupId>com.hubspot.maven.plugins</groupId>
<artifactId>prettier-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.entur.gbfs.validation.model.ValidationResult;
import org.entur.lamassu.cache.StationSpatialIndexId;
import org.entur.lamassu.cache.VehicleSpatialIndexId;
import org.entur.lamassu.config.project.LamassuProjectInfoConfiguration;
import org.entur.lamassu.model.entities.GeofencingZones;
import org.entur.lamassu.model.entities.Station;
import org.entur.lamassu.model.entities.Vehicle;
Expand All @@ -16,6 +17,7 @@
import org.redisson.codec.Kryo5Codec;
import org.redisson.config.Config;
import org.redisson.spring.data.connection.RedissonConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -33,18 +35,19 @@ public class RedissonCacheConfig {
public static final String VALIDATION_REPORTS_CACHE_KEY = "validationReportsCache";
public static final String CACHE_READY_KEY = "cacheReady";

@Value("${org.entur.lamassu.serializationVersion}")
private String serializationVersion;

private final String serializationVersion;
private final Config redissonConfig;

public RedissonCacheConfig(
@Value("${org.entur.lamassu.redis.master.host}") String masterHost,
@Value("${org.entur.lamassu.redis.master.port}") String masterPort,
@Value("${org.entur.lamassu.redis.slave.enabled:false}") boolean slaveEnabled,
@Value("${org.entur.lamassu.redis.slave.host:na}") String slaveHost,
@Value("${org.entur.lamassu.redis.slave.port:na}") String slavePort
@Value("${org.entur.lamassu.redis.slave.port:na}") String slavePort,
LamassuProjectInfoConfiguration lamassuProjectInfoConfiguration
) {
serializationVersion = lamassuProjectInfoConfiguration.getSerializationVersion();

redissonConfig = new Config();

var codec = new Kryo5Codec(this.getClass().getClassLoader());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.config.project;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class LamassuProjectInfo {

private static final String FILENAME = "lamassu-project-info.properties";

static LamassuProjectInfo loadFromProperties() throws IOException {
InputStream in =
LamassuProjectInfo.class.getClassLoader().getResourceAsStream(FILENAME);
Properties props = new java.util.Properties();
props.load(in);

return new LamassuProjectInfo(
props.getProperty("project.version"),
props.getProperty("lamassu.serialization.version.id")
);
}

private final String projectVersion;
private final String serializationVersion;

LamassuProjectInfo(String projectVersion, String serializationVersion) {
this.projectVersion = projectVersion;
this.serializationVersion = serializationVersion;
}

public String getProjectVersion() {
return projectVersion;
}

public String getSerializationVersion() {
return serializationVersion;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
*
*
* * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
* * the European Commission - subsequent versions of the EUPL (the "Licence");
* * You may not use this work except in compliance with the Licence.
* * You may obtain a copy of the Licence at:
* *
* * https://joinup.ec.europa.eu/software/page/eupl
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the Licence is distributed on an "AS IS" basis,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the Licence for the specific language governing permissions and
* * limitations under the Licence.
*
*/

package org.entur.lamassu.config.project;

import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LamassuProjectInfoConfiguration {

private static final Logger LOG = LoggerFactory.getLogger(
LamassuProjectInfoConfiguration.class
);

private final LamassuProjectInfo projectInfo;

public LamassuProjectInfoConfiguration() throws IOException {
this.projectInfo = LamassuProjectInfo.loadFromProperties();
LOG.info("Project version: {}", getProjectVersion());
LOG.info("Serialization version : {}", getSerializationVersion());
}

public String getSerializationVersion() {
return projectInfo.getSerializationVersion();
}

public String getProjectVersion() {
return projectInfo.getProjectVersion();
}
}
Loading