Skip to content

Gradle rework and version updates #114

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

Merged
merged 6 commits into from
Jan 16, 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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*.{kt,kts}]
indent_size = 4
ignored_rules = no-wildstar-imports
insert_final_newline = true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @patjackson52 @mpetuska
113 changes: 88 additions & 25 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,97 @@ on:
branches: [ master ]

jobs:
resolve-version:
uses: ./.github/workflows/resolve-version.yml
needs: [ check ]
with:
desired-version: ${{ github.event.release.tag_name || github.event.inputs.version }}

publish-snapshot:
runs-on: ${{ matrix.os }}
needs:
- resolve-version
runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
GH_USERNAME: ${{ github.actor }}
GH_PASSWORD: ${{ github.token }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
repository:
- name: Github Packages
tasks: publishAllPublicationsToGitHubRepository
enabled: ${{ github.event.inputs.skipGitHub != 'y' }}
- name: Maven Central
# `closeSonatypeStagingRepository` Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories
# If you're brave, you could change it to `closeAndReleaseSonatypeStagingRepository` to fully automate the release
tasks: publishToSonatype closeAndReleaseSonatypeStagingRepository
enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }}
os:
- runner: macos-latest
shell: bash
- runner: windows-latest
shell: msys2 {0}
- runner: ubuntu-latest
shell: bash

steps:
- uses: actions/checkout@v2

- name: Publish Snapshot
env:
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
SNAPSHOT: 'TRUE'
run: ./gradlew publish

- name: Archive redux-kotlin publications dir
uses: actions/upload-artifact@v1
with:
name: publications-${{ matrix.os }}
path: redux-kotlin/build/publications

- name: Archive redux-kotlin-threadsafe publications dir
if: steps.publish.outputsexit_code == 0
uses: actions/upload-artifact@v1
with:
name: publications-threadsafe-${{ matrix.os }}
path: redux-kotlin-threadsafe/build/publications
steps:
- uses: msys2/setup-msys2@v2
if: ${{ matrix.repository.enabled == true && runner.os == 'Windows' }}
with:
release: false
msystem: MINGW64
update: true
path-type: inherit
install: >-
mingw-w64-x86_64-curl
curl

- uses: actions/checkout@v3
if: ${{ matrix.repository.enabled == true }}

- uses: actions/setup-java@v3
if: ${{ matrix.repository.enabled == true }}
with:
distribution: 'adopt'
java-version: 11

- name: Restore Gradle cache
if: ${{ matrix.repository.enabled == true }}
id: cache-gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Gradle Publish to ${{ matrix.repository.name }}
if: ${{ matrix.repository.enabled == true }}
run: ./gradlew ${{ matrix.repository.tasks }} -Pversion=${VERSION//v} --scan

- name: Archive redux-kotlin publications dir
uses: actions/upload-artifact@v1
with:
name: publications-${{ matrix.os }}
path: redux-kotlin/build/publications

- name: Archive redux-kotlin-threadsafe publications dir
if: steps.publish.outputsexit_code == 0
uses: actions/upload-artifact@v1
with:
name: publications-threadsafe-${{ matrix.os }}
path: redux-kotlin-threadsafe/build/publications

34 changes: 31 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,45 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Ktlint
uses: "vroy/gha-kotlin-linter@v1"
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11

- name: Detekt
run: ./gradlew detektAll

- name: Make artifact location URIs relative
if: ${{ always() }}
continue-on-error: true
run: |
ls '${{ github.workspace }}/build/reports/detekt/'
cp '${{ github.workspace }}/build/reports/detekt/detekt.sarif' '${{ github.workspace }}/detekt.sarif.json'
echo "$(
jq --arg github_workspace ${{ github.workspace }} \
'. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
'${{ github.workspace }}/detekt.sarif.json'
)" > '${{ github.workspace }}/detekt.sarif.json'

- uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
with:
sarif_file: ${{ github.workspace }}/detekt.sarif.json
checkout_path: ${{ github.workspace }}
test:
needs: ktlint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11

- name: Test
run: ./gradlew allTest

Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/resolve-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Resolve Version

on:
workflow_call:
inputs:
desired-version:
type: string
description: Optional desired version
required: false
outputs:
version:
value: ${{ jobs.resolve.outputs.version }}
snapshot:
value: ${{ jobs.resolve.outputs.version }}

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}

jobs:
resolve:
name: Resolve Version
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.desired-version }}
outputs:
version: ${{ steps.resolve.outputs.version }}
snapshot: ${{ steps.resolve.outputs.snapshot }}
steps:
- uses: actions/checkout@v3
- name: Resolve
id: resolve
run: |
project_version=$(cat gradle.properties | grep -Po '^version=\K(.+)')
version=${VERSION:=$project_version}
VERSION=${VERSION/v}
echo "PROJECT_VERSION=${project_version}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "::set-output name=version::${VERSION}"
if [[ "$VERSION" != "$project_version" ]]; then
echo "DIFF_VERSION=1" >> $GITHUB_ENV
fi
if [[ "$VERSION" == *-SNAPSHOT ]]; then
echo "::set-output name=snapshot::true"
else
echo "::set-output name=snapshot::false"
fi
- name: Report
run: |
echo "VERSION=${{ env.VERSION }}"
echo "steps.resolve.outputs.version=${{ steps.resolve.outputs.version }}"
- name: Create Snapshot
if: env.DIFF_VERSION == '1'
run: |
main_version=$(echo $VERSION | grep -Po '^([0-9]+.){2}(?=.*)')
patch_version=$(echo $VERSION | grep -Po "^$main_version\\K([0-9]+)(?=.*)")
patch_version=$(expr $patch_version + 1)
SNAPSHOT_VERSION="${main_version}${patch_version}-SNAPSHOT"
echo "SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> $GITHUB_ENV
sed -Ei "s|^(version=).*\$|\\1$SNAPSHOT_VERSION|" gradle.properties
- name: Commit and push SNAPSHOT
if: env.DIFF_VERSION == '1' && env.PROJECT_VERSION != env.SNAPSHOT_VERSION
uses: devops-infra/action-commit-push@v0.9.2
with:
github_token: ${{ secrets.GH_TOKEN || github.token }}
commit_message: '[ci skip] New SNAPSHOT - ${{ env.SNAPSHOT_VERSION }}'
target_branch: master
20 changes: 8 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
*.iml
.gradle
.gradle/
lint.xml
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea
.idea/
/iOS/NameGame/.idea/
.DS_Store
/build
/common/build
*.hprof
/captures
.externalNativeBuild
node_modules/
Expand All @@ -24,7 +21,6 @@ node_modules/
build/
DerivedData/


## Various settings
*.pbxuser
!default.pbxuser
Expand Down Expand Up @@ -89,11 +85,11 @@ fastlane/test_output
# End of https://www.gitignore.io/api/swift,xcode

# From redux
dist
dist/
es
coverage
coverage/

website/translated_docs
website/translated_docs/
website/build/
website/node_modules
website/node_modules/
website/i18n/*
57 changes: 41 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,65 @@
## Unreleased

### Added

- All missing ios, watchos, tvos and macos simulator targets added
- Added `androidNativeX64` and `androidNativeX86` targets
- Added proper android release and debug variants instead of piggybacking on jvm artefact

### Changed

- Major gradle infra rework
- Enabled `explicitPublicApi()`
- BREAKING: `redux-kotlin-threadsafe` APIs moved to a new package: `org.reduxkotlin.threadsafe`

### Removed

- Remove deprecated `wasm32` target

## [0.5.5] - 2020-08-16
- update to Kotlin 1.4.0
- added platforms (androidNativeArm32, androidNativeArm64, iosArm32, linuxArm64, linuxX64,

- update to Kotlin 1.4.0
- added platforms (androidNativeArm32, androidNativeArm64, iosArm32, linuxArm64, linuxX64,
mingwX86, tvosArm64, tvosX64, watchosArm32, watchosArm64, watchosX86)
- remove spek & atrium deps and use plain kotlin tests & assertions. Tests run for all platforms now.
- remove spek & atrium deps and use plain kotlin tests & assertions. Tests run for all platforms now.

## [0.5.2] - 2020-07-03
- publish all available platforms to maven
- add CI/CD through github actions

- publish all available platforms to maven
- add CI/CD through github actions

## [0.5.1] - 2020-06-11
- update lib dependency to api import, so core lib is included in redux-kotlin-threadsafe

- update lib dependency to api import, so core lib is included in redux-kotlin-threadsafe

## [0.5.0] - 2020-06-11
- kotlin 1.3.72
- createThreadSafeStore fun added for thread synchronized access
- createEnsureSameThreadStore to provide existing same-thread-enforcement

- kotlin 1.3.72
- createThreadSafeStore fun added for thread synchronized access
- createEnsureSameThreadStore to provide existing same-thread-enforcement

## [0.4.0] - 2020-03-23
- kotlin 1.3.70

- kotlin 1.3.70

## [0.3.2] - 2020-02-22
- issue #34 - incorrect same thread enforcement behavior fixed

- issue #34 - incorrect same thread enforcement behavior fixed

## [0.3.1] - 2019-12-16

### Changed
- update same thread enforcement message to not be getState only

- update same thread enforcement message to not be getState only

## [0.3.0] - 2019-12-16

### Added
- thread enforcement

- thread enforcement

## [0.2.9] - 2019-11-23

### Changed
- update Kotlin to 1.3.60
### Changed

- update Kotlin to 1.3.60
Loading