Skip to content

Commit 4222009

Browse files
committed
GH actions draft
1 parent 52ed937 commit 4222009

File tree

7 files changed

+341
-3
lines changed

7 files changed

+341
-3
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
- package-ecosystem: "gradle"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/workflows/check.yml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
workflow_dispatch:
8+
workflow_call:
9+
10+
concurrency:
11+
cancel-in-progress: true
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
13+
14+
env:
15+
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
16+
17+
jobs:
18+
check:
19+
name: Check on ${{ matrix.os.runner }}
20+
runs-on: ${{ matrix.os.runner }}
21+
defaults:
22+
run:
23+
shell: ${{ matrix.os.shell }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os:
28+
- runner: macos-latest
29+
shell: bash
30+
separator: '/'
31+
- runner: ubuntu-latest
32+
shell: bash
33+
separator: '/'
34+
- runner: windows-latest
35+
shell: msys2 {0}
36+
separator: '\'
37+
steps:
38+
- uses: msys2/setup-msys2@v2
39+
if: ${{ runner.os == 'Windows' }}
40+
with:
41+
release: false
42+
msystem: MINGW64
43+
path-type: inherit
44+
update: true
45+
install: >-
46+
curl
47+
mingw-w64-x86_64-curl
48+
49+
- uses: actions/checkout@v3.0.2
50+
51+
- uses: actions/setup-java@v3
52+
with:
53+
distribution: 'adopt'
54+
java-version: 11
55+
56+
- name: Restore Gradle cache
57+
id: cache-gradle
58+
uses: actions/cache@v3.0.5
59+
with:
60+
path: |
61+
~/.gradle/caches
62+
~/.gradle/wrapper
63+
~/.gradle/yarn
64+
~/.gradle/nodejs
65+
~/.konan
66+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
67+
restore-keys: ${{ runner.os }}-gradle-
68+
69+
- name: Gradle Compile
70+
run: ./gradlew compile assemble --scan
71+
72+
- name: Gradle Check
73+
run: ./gradlew check --scan
74+
75+
- name: Make artifact location URIs relative
76+
if: ${{ always() }}
77+
continue-on-error: true
78+
run: |
79+
ls '${{ github.workspace }}${{ matrix.os.separator }}build${{ matrix.os.separator }}reports${{ matrix.os.separator }}detekt${{ matrix.os.separator }}'
80+
cp '${{ github.workspace }}${{ matrix.os.separator }}build${{ matrix.os.separator }}reports${{ matrix.os.separator }}detekt${{ matrix.os.separator }}detekt.sarif' '${{ github.workspace }}${{ matrix.os.separator }}detekt.sarif.json'
81+
echo "$(
82+
jq --arg github_workspace ${{ github.workspace }} \
83+
'. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
84+
'${{ github.workspace }}${{ matrix.os.separator }}detekt.sarif.json'
85+
)" > '${{ github.workspace }}${{ matrix.os.separator }}detekt.sarif.json'
86+
87+
- uses: github/codeql-action/upload-sarif@v2
88+
if: ${{ always() }}
89+
with:
90+
sarif_file: ${{ github.workspace }}${{ matrix.os.separator }}detekt.sarif.json
91+
checkout_path: ${{ github.workspace }}
92+
93+
- uses: actions/upload-artifact@v3
94+
if: ${{ always() }}
95+
with:
96+
name: reports-${{ runner.os }}
97+
path: |
98+
**${{ matrix.os.separator }}build${{ matrix.os.separator }}reports

.github/workflows/release.yml

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
required: true
8+
description: Package version to publish under
9+
skipPages:
10+
description: Should we skip releasing GitHub pages
11+
required: false
12+
default: "y"
13+
skipMavenCentral:
14+
description: Should we skip publishing artefacts to Maven Central
15+
required: false
16+
default: "y"
17+
skipGitHub:
18+
description: Should we skip publishing artefacts to GitHub Packages
19+
required: false
20+
default: "y"
21+
release:
22+
types: [ created ]
23+
24+
env:
25+
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
26+
27+
jobs:
28+
check:
29+
uses: ./.github/workflows/check.yml
30+
31+
resolve-version:
32+
uses: ./.github/workflows/resolve-version.yml
33+
with:
34+
desired-version: ${{ github.event.release.tag_name | github.event.inputs.version }}
35+
36+
build:
37+
name: Build Dokka
38+
needs: [ check, resolve-version ]
39+
runs-on: ubuntu-latest
40+
env:
41+
VERSION: ${{ needs.resolve-version.outputs.version }}
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- uses: actions/setup-java@v3
46+
with:
47+
distribution: 'adopt'
48+
java-version: 11
49+
50+
- name: Restore Gradle cache
51+
id: cache-gradle
52+
uses: actions/cache@v3.0.5
53+
with:
54+
path: |
55+
~/.gradle/caches
56+
~/.gradle/wrapper
57+
~/.gradle/yarn
58+
~/.gradle/nodejs
59+
~/.konan
60+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
61+
restore-keys: ${{ runner.os }}-gradle-
62+
63+
- name: Gradle Assemble Dokka
64+
run: ./gradlew dokkaHtmlMultiModule -Pversion=${VERSION//v} --scan
65+
66+
- uses: actions/upload-artifact@v3
67+
with:
68+
name: dokka
69+
path: |
70+
**/build/dokka
71+
72+
# release-Artefacts:
73+
# name: Release to ${{ matrix.repository.name }} on ${{ matrix.os.runner }}
74+
# runs-on: ${{ matrix.os.runner }}
75+
# needs: [ check ]
76+
# defaults:
77+
# run:
78+
# shell: ${{ matrix.os.shell }}
79+
# env:
80+
# GH_USERNAME: ${{ github.actor }}
81+
# GH_PASSWORD: ${{ github.token }}
82+
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
83+
# ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
84+
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
85+
# ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
86+
# ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
87+
# strategy:
88+
# matrix:
89+
# repository:
90+
# - name: Github Packages
91+
# tasks: publishAllPublicationsToGitHubRepository
92+
# enabled: ${{ github.event.inputs.skipGitHub != 'y' }}
93+
# - name: Maven Central
94+
# # Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories
95+
# # If you're brave, you could change it to `publishToSonatype closeAndReleaseSonatypeStagingRepository` to fully automate the release
96+
# tasks: publishToSonatype closeSonatypeStagingRepository
97+
# enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }}
98+
# os:
99+
# - runner: macos-latest
100+
# shell: bash
101+
# - runner: windows-latest
102+
# shell: msys2 {0}
103+
# - runner: ubuntu-latest
104+
# shell: bash
105+
# steps:
106+
# - uses: msys2/setup-msys2@v2
107+
# if: ${{ matrix.repository.enabled == true && runner.os == 'Windows' }}
108+
# with:
109+
# release: false
110+
# msystem: MINGW64
111+
# update: true
112+
# path-type: inherit
113+
# install: >-
114+
# mingw-w64-x86_64-curl
115+
# curl
116+
#
117+
# - uses: actions/checkout@v3.0.2
118+
# if: ${{ matrix.repository.enabled == true }}
119+
#
120+
# - uses: actions/setup-java@v3
121+
# if: ${{ matrix.repository.enabled == true }}
122+
# with:
123+
# distribution: 'adopt'
124+
# java-version: 11
125+
#
126+
# - name: Restore Gradle cache
127+
# if: ${{ matrix.repository.enabled == true }}
128+
# id: cache-gradle
129+
# uses: actions/cache@v3.0.5
130+
# with:
131+
# path: |
132+
# ~/.gradle/caches
133+
# ~/.gradle/wrapper
134+
# ~/.gradle/yarn
135+
# ~/.gradle/nodejs
136+
# ~/.konan
137+
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
138+
# restore-keys: ${{ runner.os }}-gradle-
139+
#
140+
# - name: Resolve Version
141+
# if: ${{ matrix.repository.enabled == true }}
142+
# run: |
143+
# VERSION=${VERSION:=${{ github.event.inputs.version }}}
144+
# echo "VERSION=${VERSION/v}" >> $GITHUB_ENV
145+
#
146+
# - name: Gradle Publish to ${{ matrix.repository.name }}
147+
# if: ${{ matrix.repository.enabled == true }}
148+
# run: ./gradlew ${{ matrix.repository.tasks }} -Pversion=${VERSION//v} --scan
149+
#
150+
# release-Dokka:
151+
# runs-on: ubuntu-latest
152+
# needs: [ build ]
153+
# if: ${{ github.event.inputs.skipPages != 'y' }}
154+
# steps:
155+
# - uses: actions/download-artifact@v3
156+
# with:
157+
# name: dokka
158+
#
159+
# - name: Resolve Version
160+
# run: |
161+
# VERSION=${VERSION:=${{ github.event.inputs.version }}}
162+
# echo "VERSION=${VERSION/v}" >> $GITHUB_ENV
163+
#
164+
# - name: Build Dokka Pages
165+
# run: |
166+
# REPO_NAME=${{ github.repository }}
167+
# REPO_NAME=${REPO_NAME#${{ github.repository_owner }}/}
168+
# cp -avr build/dokka/htmlMultiModule/ public;
169+
# find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
170+
# echo "/${REPO_NAME} /${REPO_NAME}/${REPO_NAME}/index.html 301" > public/_redirects;
171+
# echo "/${REPO_NAME}/index.html /${REPO_NAME}/${REPO_NAME}/index.html 301" >> public/_redirects;
172+
#
173+
# - uses: crazy-max/ghaction-github-pages@v3.0.0
174+
# with:
175+
# target_branch: gh-pages
176+
# build_dir: public
177+
# env:
178+
# GITHUB_TOKEN: ${{ github.token }}

.github/workflows/resolve-version.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Resolve Version
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
desired-version:
7+
type: string
8+
description: Optional desired version
9+
required: false
10+
11+
concurrency:
12+
cancel-in-progress: true
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
14+
15+
jobs:
16+
resolve:
17+
name: Resolve Version
18+
runs-on: ubuntu-latest
19+
env:
20+
VERSION: ${{ inputs.desired-version }}
21+
outputs:
22+
version: ${{ steps.resolve.outputs.version }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Resolve
26+
id: resolve
27+
run: |
28+
gradle_version=$(cat gradle.properties | grep -Po '^version=\K(.+)')
29+
version=${VERSION:=gradle_version}
30+
VERSION=${VERSION/v}
31+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
32+
echo "::set-output name=version::${VERSION}"
33+
if [[ "$VERSION" != "$gradle_version" ]]; then
34+
echo "DIFF_VERSION=1" >> $GITHUB_ENV
35+
fi
36+
- name: Report
37+
run: |
38+
echo "VERSION=${{ env.VERSION }}"
39+
echo "steps.resolve.outputs.version=${{ steps.resolve.outputs.version }}"
40+
- name: Create Snapshot
41+
if: env.DIFF_VERSION == '1'
42+
run: |
43+
main_version=$(echo $VERSION | grep -Po '^([0-9]+.){2}(?=.*)')
44+
patch_version=$(echo $VERSION | grep -Po "^$main_version\\K([0-9]+)(?=.*)")
45+
patch_version=$(expr $patch_version + 1)
46+
SNAPSHOT_VERSION="${main_version}${patch_version}-SNAPSHOT"
47+
echo "SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> $GITHUB_ENV
48+
sed -Ei "s|^(version=).*\$|\\1$SNAPSHOT_VERSION|" gradle.properties
49+
- name: Commit and push SNAPSHOT
50+
if: env.DIFF_VERSION == '1'
51+
uses: devops-infra/action-commit-push@v0.9.0
52+
with:
53+
github_token: ${{ github.token }}
54+
commit_message: [ci skip] New SNAPSHOT - ${{ env.SNAPSHOT_VERSION }}

build-conventions/src/main/kotlin/convention.publishing.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
21
import org.jetbrains.kotlin.konan.target.HostManager
32
import util.Git
43

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ gh.owner.organization.url=http://www.reduxkotlin.org
2121
#======================================= Project ========================================
2222
group=org.reduxkotlin
2323
description=Compose Multiplatform integration for Redux-Kotlin
24-
version=0.0.0
24+
version=0.0.0-SNAPSHOT
2525
#======================================== Build =========================================
2626
# linux | macos | windows
2727
project.mainOS=linux

src/jsTest/kotlin/StoreProviderTest.kt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package org.reduxkotlin.compose
22

33
import androidx.compose.runtime.getValue
44
import org.jetbrains.compose.web.dom.Button
5-
import org.jetbrains.compose.web.dom.Div
65
import org.jetbrains.compose.web.dom.Text
76
import org.jetbrains.compose.web.testutils.ComposeWebExperimentalTestsApi
87
import org.jetbrains.compose.web.testutils.runTest

0 commit comments

Comments
 (0)