-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
330 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Gradle Wrapper Validation | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
validate-project-gradle-wrapper: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Validate | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout latest code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
publish-release: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Publish Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Gradle Dirs | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} | ||
restore-keys: cache-gradle- | ||
|
||
- name: Deploy Release | ||
env: | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_SIGNING_KEY: ${{ secrets.SONATYPE_NEXUS_SIGNING_KEY }} | ||
run: ./gradlew uploadArchives --no-daemon --no-parallel --stacktrace | ||
|
||
- name: Stop Gradle | ||
run: ./gradlew --stop | ||
|
||
- name: Extract Release Notes | ||
id: release-notes | ||
uses: ffurrer2/extract-release-notes@v1 | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: ${{ steps.release-notes.outputs.release_notes }} | ||
files: | | ||
./library/*/build/outputs/aar/*.aar | ||
./library/*/build/libs/!(*-sources|*-javadoc).jar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Snapshot | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
publish-snapshot: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Publish Snapshot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Gradle Dirs | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} | ||
restore-keys: cache-gradle- | ||
|
||
- name: Deploy Snapshot | ||
env: | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
run: ./gradlew uploadArchives --no-daemon --no-parallel --stacktrace | ||
|
||
- name: Stop Gradle | ||
run: ./gradlew --stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Quality Check | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- 'library/docs/**' | ||
- '**.md' | ||
- '.github/CODEOWNERS' | ||
pull_request: | ||
paths-ignore: | ||
- 'library/docs/**' | ||
- '**.md' | ||
- '.github/CODEOWNERS' | ||
|
||
jobs: | ||
tests: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Gradle Dirs | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} | ||
restore-keys: cache-gradle- | ||
|
||
- name: Run Tests | ||
run: ./gradlew test --stacktrace | ||
|
||
- name: Stop Gradle | ||
run: ./gradlew --stop | ||
|
||
detekt: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Detekt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Gradle Dirs | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} | ||
restore-keys: cache-gradle- | ||
|
||
- name: Run Detekt | ||
run: ./gradlew detekt --stacktrace | ||
|
||
- name: Stop Gradle | ||
run: ./gradlew --stop | ||
|
||
lint: | ||
if: ${{ github.repository == 'MiSikora/Ruler' }} | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Gradle Dirs | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} | ||
restore-keys: cache-gradle- | ||
|
||
- name: Run Lint | ||
run: ./gradlew lint --stacktrace | ||
|
||
- name: Stop Gradle | ||
run: ./gradlew --stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Ruler | ||
|
||
Distance measurements library for Java and Android. | ||
|
||
## Integration | ||
|
||
Ruler requires Java 8 bytecode. To enable Java 8 desugaring configure it in your Gradle script. | ||
|
||
```groovy | ||
android { | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
// For Kotlin projects | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
``` | ||
|
||
To integrate it with your app you need to add a dependency to you project. | ||
|
||
```groovy | ||
debugImplementation "io.mehow.ruler:ruler:0.5.3" | ||
``` | ||
|
||
If you use Android you can use Android artifact. | ||
|
||
```groovy | ||
debugImplementation "io.mehow.ruler:android:0.5.3" | ||
``` | ||
|
||
## License | ||
|
||
Copyright 2020 Michał Sikora | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Releasing | ||
|
||
## Versioning | ||
|
||
1. Run the [prepare release script](https://github.com/MiSikora/Laboratory/blob/master/prepare-release.sh) and bump the desirable version part. | ||
2. If there are no errors `git push && git push --tags`. | ||
3. Wait for [the CI server](https://github.com/MiSikora/Ruler/actions) to upload the artifacts. | ||
4. Visit [Sonatype Nexus](https://oss.sonatype.org) and promote the artifacts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
if [[ $(git rev-parse --abbrev-ref HEAD) != master ]]; then | ||
echo Release version can be prepared automatically only from the master branch. | ||
exit 0 | ||
fi | ||
|
||
currentVersion=$(git describe --abbrev=0) | ||
currentMajor=$(echo "$currentVersion" | cut -d. -f1) | ||
currentMinor=$(echo "$currentVersion" | cut -d. -f2) | ||
currentPatch=$(echo "$currentVersion" | cut -d. -f3) | ||
|
||
echo "Ruler $currentVersion:" | ||
|
||
PS3=$"What do you want to do? " | ||
options=("Bump major" "Bump minor" "Bump patch" "Quit") | ||
select option in "${options[@]}" | ||
do | ||
case $option in | ||
"Bump major" ) | ||
newVersion="$((currentMajor + 1)).0.0" | ||
break ;; | ||
"Bump minor" ) | ||
newVersion="$currentMajor.$((currentMinor + 1)).0" | ||
break ;; | ||
"Bump patch" ) | ||
newVersion="$currentMajor.$currentMinor.$((currentPatch + 1))" | ||
break ;; | ||
"Quit" ) | ||
exit 0 ;; | ||
* ) | ||
echo "Invalid option '$REPLY'." | ||
exit 0 ;; | ||
esac | ||
done | ||
|
||
function confirmBump { | ||
read -rp "Bump version from $currentVersion to $newVersion? [Y/n] " choice | ||
case "$choice" in | ||
[nN][oO]|[n|N] ) echo 1 ;; | ||
* ) echo 0 ;; | ||
esac | ||
} | ||
|
||
if [[ $(confirmBump) != 0 ]] ; then | ||
echo "No" | ||
exit 0 | ||
else | ||
echo "Yes" | ||
fi | ||
|
||
# Replace current version in gradle.properties | ||
propertiesFile="./gradle.properties" | ||
versionNameKey="VERSION_NAME" | ||
sed -i "" "s/.*$versionNameKey.*/$versionNameKey=$newVersion/g" $propertiesFile | ||
|
||
# Replace current version in changelog.md and update hyperlinks | ||
changelogFile="./docs/changelog.md" | ||
today=$(date +%F) | ||
sed -i "" "s/## \[Unreleased\]/## \[Unreleased\]"$'\\\n\\\n'"## \[$newVersion\] - $today/g" $changelogFile | ||
newVersionTag="[$newVersion]: https:\/\/github.com\/MiSikora\/Ruler\/releases\/tag\/$newVersion" | ||
sed -i "" "s/$currentVersion...HEAD/$newVersion...HEAD"$'\\\n'"$newVersionTag""/g" $changelogFile | ||
|
||
# Replace current version in index.md | ||
indexFile="./docs/index.md" | ||
sed -i "" "s/$currentVersion/$newVersion/g" $indexFile | ||
|
||
# Replace current version in README.md | ||
readmeFile="./README.md" | ||
sed -i "" "s/$currentVersion/$newVersion/g" $readmeFile | ||
|
||
git reset &> /dev/null | ||
git commit -am "Prepare for release $newVersion" &> /dev/null | ||
git tag -a "$newVersion" -m "Version $newVersion" &> /dev/null | ||
|
||
# Update current version to a snapshot one | ||
newMajor="$(cut -d"." -f1 <<<"$newVersion")" | ||
newMinor="$(cut -d"." -f2 <<<"$newVersion")" | ||
newPatch="$(cut -d"." -f3 <<<"$newVersion")" | ||
newSnapshotVersion="$newMajor.$newMinor.$((newPatch + 1))-SNAPSHOT" | ||
sed -i "" "s/.*$versionNameKey.*/$versionNameKey=$newSnapshotVersion/g" $propertiesFile | ||
|
||
git commit -am "Prepare next development version" &> /dev/null | ||
|
||
echo "\ | ||
Version bumped successfully to $newVersion and commit is tagged. \ | ||
Changes can be pushed to the origin." |