diff --git a/.github/scripts/publish-latest-release.sh b/.github/scripts/publish-latest-release.sh deleted file mode 100755 index dd105f5c3af..00000000000 --- a/.github/scripts/publish-latest-release.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Reason: it's not possible to sync all the directories because of 'docs/0.10', 'docs/next', etc. -# and latest release appears in the root directory - -set -e - -cd _site/ -for file in *; do - if [ "$file" != "index.html" ]; then - if [ -f "$file" ]; then - echo "Copying $file ..." - aws s3 cp $file s3://$S3_BUCKET/docs/$file >> $BASEDIR/logs/aws_sync.log - continue - fi - echo "Sync $file ..." - aws s3 sync $file s3://$S3_BUCKET/docs/$file --delete >> $BASEDIR/logs/aws_sync.log - fi -done diff --git a/.github/scripts/set-env.sh b/.github/scripts/set-env.sh deleted file mode 100755 index 3ddbe6790b5..00000000000 --- a/.github/scripts/set-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -ex - -# echo "$JAVA_HOME_8_X64/bin" >> $GITHUB_PATH -# echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV - -NEW_RELEASE_VERSION_EXISTS=0 -if [ "$GITHUB_REF" == "refs/heads/main" ]; then - if [[ $OSTYPE == 'darwin'* ]]; then - LATEST_PUBLISHED_VERSION=$(curl -L https://repo1.maven.org/maven2/io/arrow-kt/arrow-core/maven-metadata.xml | ggrep -oP '\K[^<]*') - else - export LC_ALL=en_US.utf8; - LATEST_PUBLISHED_VERSION=$(curl -L https://repo1.maven.org/maven2/io/arrow-kt/arrow-core/maven-metadata.xml | grep -oP '\K[^<]*') - fi - - if [ "$LATEST_PUBLISHED_VERSION" == "" ]; then exit 1; fi - RELEASE_VERSION=$(grep "projects.latestVersion" gradle.properties | cut -d= -f2) - if [ "$LATEST_PUBLISHED_VERSION" != "$RELEASE_VERSION" ]; then NEW_RELEASE_VERSION_EXISTS=1; fi -else - echo "Into release branch ..." - BRANCH_VERSION=$(echo $GITHUB_REF | cut -d/ -f4) - RELEASE_VERSION=$(grep "projects.latestVersion" gradle.properties | cut -d= -f2) - if [ "$BRANCH_VERSION" == "$RELEASE_VERSION" ]; then - NEW_RELEASE_VERSION_EXISTS=1 - else - perl -pe "s/^projects.version=.*/projects.version=$BRANCH_VERSION-SNAPSHOT/g" -i gradle.properties - fi -fi - -if [ $NEW_RELEASE_VERSION_EXISTS == 1 ]; then - perl -pe "s/^projects.version=.*/projects.version=$RELEASE_VERSION/g" -i gradle.properties - perl -pe "s/^org.gradle.parallel=.*/org.gradle.parallel=false/g" -i gradle.properties -fi - -echo "LATEST_PUBLISHED_VERSION=$LATEST_PUBLISHED_VERSION" >> $GITHUB_ENV -echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV -echo "NEW_RELEASE_VERSION_EXISTS=$NEW_RELEASE_VERSION_EXISTS" >> $GITHUB_ENV diff --git a/.github/scripts/show-env.sh b/.github/scripts/show-env.sh deleted file mode 100755 index c6805f06130..00000000000 --- a/.github/scripts/show-env.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -# grep projects.version $BASEDIR/gradle.properties -echo "LATEST_PUBLISHED_VERSION: $LATEST_PUBLISHED_VERSION" -echo "RELEASE_VERSION: $RELEASE_VERSION" -echo "NEW_RELEASE_VERSION_EXISTS: $NEW_RELEASE_VERSION_EXISTS" diff --git a/.github/scripts/sync-docs-with-aws.sh b/.github/scripts/sync-docs-with-aws.sh new file mode 100755 index 00000000000..12fde2e01df --- /dev/null +++ b/.github/scripts/sync-docs-with-aws.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Reason: it's not possible to sync all the directories because of 'docs/0.10', 'docs/next', etc. +# and latest release appears in the root directory + +set -e + +cd _site/ +for file in *; do + if [ -f "$file" ]; then + echo "Copying $file ..." + aws s3 cp $file s3://$S3_BUCKET/docs/$file --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log + continue + fi + echo "Sync $file ..." + aws s3 sync $file s3://$S3_BUCKET/docs/$file --delete --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log +done diff --git a/.github/scripts/publish-landing-page.sh b/.github/scripts/sync-main-with-aws.sh similarity index 58% rename from .github/scripts/publish-landing-page.sh rename to .github/scripts/sync-main-with-aws.sh index f46665a8383..d4a5d2140f8 100755 --- a/.github/scripts/publish-landing-page.sh +++ b/.github/scripts/sync-main-with-aws.sh @@ -1,18 +1,19 @@ #!/bin/bash -# Reason: The root directory also has docs/, docs/next/ and docs/. +# Reason: it's not possible to sync all the directories because of 'docs/0.10', 'docs/next', etc. +# and latest release appears in the root directory set -e -MAIN_CONTENT=("CNAME" "code" "css" "error.html" "fonts" "img" "index.html" "js" "redirects.json") - cd _site/ -for file in ${MAIN_CONTENT[*]}; do + +for file in *; do if [ -f "$file" ]; then echo "Copying $file ..." aws s3 cp $file s3://$S3_BUCKET/$file >> $BASEDIR/logs/aws_sync.log continue fi + echo "Sync $file ..." aws s3 sync $file s3://$S3_BUCKET/$file --delete >> $BASEDIR/logs/aws_sync.log done diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4f0a440474b..25053b0f624 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,6 +31,9 @@ jobs: matrix: os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ] + outputs: + arrow-version: ${{ steps.get-arrow-version.outputs.arrow-version }} + steps: - name: Checkout uses: actions/checkout@v2.4.0 @@ -58,6 +61,10 @@ jobs: - name: Build run: ./gradlew build + - id: get-arrow-version + name: Get Arrow version + run: echo "::set-output name=arrow-version::$(head -n 1 build/semver/version.txt| cut -d. -f1-2)" + - name: Stop Gradle daemons run: ./gradlew --stop @@ -114,17 +121,21 @@ jobs: S3_BUCKET: ${{ secrets.S3_BUCKET }} steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2.4.0 with: fetch-depth: 0 - - name: "Setup" - run: brew install grep + - name: Set up Java + uses: actions/setup-java@v2.4.0 + with: + distribution: 'zulu' + java-version: 11 - name: Set version to an environment variable - run: echo "lib_version=$(head -n 1 build/semver/version.txt)" >> $GITHUB_ENV + run: echo "LIB_VERSION=${{needs.build.outputs.arrow-version}}" >> $GITHUB_ENV - - name: "Prepare environment" + - name: Prepare environment working-directory: arrow-site run: | mkdir $BASEDIR/logs @@ -132,67 +143,70 @@ jobs: bundle config set --local path 'vendor/bundle' bundle install --gemfile Gemfile - - name: "Create API doc" + - name: Create API doc run: ./gradlew dokkaGfm - - name: "Landing page: build" + - name: Build landing page working-directory: arrow-site - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + if: ${{ github.ref == 'refs/heads/main' }} run: | - bundle exec jekyll build -b docs -s docs + bundle exec jekyll build -b docs -s docs --config docs/_config_for_landing_page.yml tree _site > $BASEDIR/logs/content.log - - name: "Landing page: publish" + - name: Publish landing page working-directory: arrow-site - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + if: ${{ github.ref == 'refs/heads/main' }} run: | echo ">>> Landing page" >> $BASEDIR/logs/aws_sync.log - ${GITHUB_WORKSPACE}/.github/scripts/publish-landing-page.sh + ${GITHUB_WORKSPACE}/.github/scripts/sync-main-with-aws.sh - - name: "Latest release: publish (/docs)" + - name: Build release directory (/docs) working-directory: arrow-site - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + if: ${{ github.ref == 'refs/heads/main' && !contains(env.LIB_VERSION, "alpha") && !contains(env.LIB_VERSION, "beta") && !contains(env.LIB_VERSION, "rc") }} + run: | + bundle exec jekyll build -b docs -s docs + tree _site > $BASEDIR/logs/content_docs-${{ env.LIB_VERSION }}.log + + - name: Publish documentation (/docs) + working-directory: arrow-site + if: ${{ github.ref == 'refs/heads/main' && !contains(env.LIB_VERSION, "alpha") && !contains(env.LIB_VERSION, "beta") && !contains(env.LIB_VERSION, "rc") }} run: | echo ">>> Latest release" >> $BASEDIR/logs/aws_sync.log - ${GITHUB_WORKSPACE}/.github/scripts/publish-latest-release.sh + ${GITHUB_WORKSPACE}/.github/scripts/sync-docs-with-aws.sh - - name: "Latest release: build release directory (/docs/)" - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + - name: Build release directory (/docs/) working-directory: arrow-site + if: ${{ github.ref == 'refs/heads/main' && !contains(env.LIB_VERSION, "alpha") && !contains(env.LIB_VERSION, "beta") && !contains(env.LIB_VERSION, "rc") }} run: | - bundle exec jekyll build -b docs/${{ env.lib_version }} -s docs - tree _site > $BASEDIR/logs/content_docs-${{ env.lib_version }}.log + bundle exec jekyll build -b docs/${{ env.LIB_VERSION }} -s docs + tree _site > $BASEDIR/logs/content_docs-${{ env.LIB_VERSION }}.log - - name: "Latest release: publish release directory (/docs/)" - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + - name: Publish release directory (/docs/) working-directory: arrow-site + if: ${{ github.ref == 'refs/heads/main' && !contains(env.LIB_VERSION, "alpha") && !contains(env.LIB_VERSION, "beta") && !contains(env.LIB_VERSION, "rc") }} run: | - if [ "${{ env.lib_version }}" != "" ]; then - aws s3 sync _site s3://$S3_BUCKET/docs/${{ env.lib_version }} --delete --exclude "index.html" >> $BASEDIR/logs/aws_sync.log - else - exit 1 - fi + aws s3 sync _site s3://$S3_BUCKET/docs/${{ env.LIB_VERSION }} --delete --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log - - name: "Next version: build (/docs/next)" + - name: Build latest version (/docs/next) working-directory: arrow-site - if: ${{ github.ref == 'refs/heads/main' && contains(env.lib_version, "alpha") }} + if: ${{ github.ref == 'refs/heads/main' }} run: | bundle exec jekyll build -b docs/next -s docs tree _site > $BASEDIR/logs/content_docs-next.log - - name: "Next version: publish (/docs/next)" + - name: Publish latest version (/docs/next) working-directory: arrow-site - if: ${{ github.ref == 'refs/heads/main' && contains(env.lib_version, "alpha") }} + if: ${{ github.ref == 'refs/heads/main' }} run: | - aws s3 sync _site s3://$S3_BUCKET/docs/next --delete --exclude "index.html" >> $BASEDIR/logs/aws_sync.log + aws s3 sync _site s3://$S3_BUCKET/docs/next --delete --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log - - name: "Site: publish sitemap.xml" - if: ${{ github.ref == 'refs/heads/main' && !contains(env.lib_version, "alpha") && !contains(env.lib_version, "beta") && !contains(env.lib_version, "rc") }} + - name: Publish sitemap.xml + if: ${{ github.ref == 'refs/heads/main' && !contains(env.LIB_VERSION, "alpha") && !contains(env.LIB_VERSION, "beta") && !contains(env.LIB_VERSION, "rc") }} run: | ${GITHUB_WORKSPACE}/.github/scripts/create-sitemap.sh > sitemap.xml aws s3 cp sitemap.xml s3://$S3_BUCKET/sitemap.xml >> $BASEDIR/logs/aws_sync.log - - name: CloudFront cache invalidation + - name: Invalidate CloudFront cache run: aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_ID --paths "/*" - name: List S3 @@ -201,7 +215,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: logs - path: arrow-libs/logs + path: arrow-libs/logs. - name: Stop Gradle daemons run: ./gradlew --stop diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2e8a990db1c..f076ae29a3f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -3,7 +3,7 @@ name: "pull_request" on: pull_request env: - JAVA_OPTS: -Xms1g -Xmx3g + JAVA_OPTS: -Xms2g -Xmx4g GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" jobs: diff --git a/arrow-site/docs/_config_for_landing_page.yml b/arrow-site/docs/_config_for_landing_page.yml new file mode 100644 index 00000000000..a412b664867 --- /dev/null +++ b/arrow-site/docs/_config_for_landing_page.yml @@ -0,0 +1,36 @@ +title: Arrow +#------------------------- +name: Λrrow +#------------------------- +description: Functional companion to Kotlin's Standard Library +#------------------------- +author: The Λrrow Authors +keywords: functional-programming, kotlin-library, monads, monad-transformers, functional-data-structure, kotlin, fp-types, adt, free-monads, tagless-final, mtl, for-comprehension, category-theory +#------------------------- +url: https://arrow-kt.io +#------------------------- +github_repo: https://github.com/arrow-kt/arrow +#------------------------- +twitter_handle: "@arrow_kt" +#------------------------- +slack_kotlin_channel: "https://slack.kotlinlang.org" +slack_arrow_channel: "https://kotlinlang.slack.com/archives/C5UPMM0A0" +#------------------------- +sass: + style: compressed +#------------------------- +exclude: ['config.ru', 'Gemfile', 'Gemfile.lock', 'vendor', 'Procfile', 'Rakefile', '.bundle', 'apidocs/', 'docs/', 'css/docs-styles.scss', 'img/core/', 'img/docs/', 'img/fx/', 'img/incubator/', 'img/kotlin-stdlib.png', 'img/labels/', 'img/linting/', 'img/meta/', 'img/old-design/', 'img/optics/', 'img/quickstart/'] +#------------------------- +collections: + code: + output: true +# Default Front Matter values to be set +defaults: + - scope: + type: code + values: + layout: code + +# Plugins +plugins: + - jekyll-redirect-from diff --git a/arrow-site/docs/docs/core/README.md b/arrow-site/docs/docs/core/README.md index 08f0d76e433..09390f73654 100644 --- a/arrow-site/docs/docs/core/README.md +++ b/arrow-site/docs/docs/core/README.md @@ -80,12 +80,12 @@ boilerplate and enable direct syntax including [monad comprehensions and computa Configure Arrow for your project
-![Jdk](/img/quickstart/jdk-logo.svg "jdk") +![Jdk]({{ "/img/quickstart/jdk-logo.svg" | relative_url }} "jdk") Make sure to have the latest version of JDK 1.8 installed.
-![Android](/img/quickstart/android-logo.svg "android") +![Android]({{ "/img/quickstart/android-logo.svg" | relative_url }} "android") Arrow supports Android starting on API 21 and up. diff --git a/arrow-site/docs/docs/fx/README.md b/arrow-site/docs/docs/fx/README.md index 981382341f0..3039540d2ed 100644 --- a/arrow-site/docs/docs/fx/README.md +++ b/arrow-site/docs/docs/fx/README.md @@ -79,12 +79,12 @@ s [Coroutines Guide](https://kotlinlang.org/docs/coroutines-guide.html) on Kotli Configure Arrow for your project
-![Jdk](/img/quickstart/jdk-logo.svg "jdk") +![Jdk]({{ "/img/quickstart/jdk-logo.svg" | relative_url }} "jdk") Make sure to have the latest version of JDK 1.8 installed.
-![Android](/img/quickstart/android-logo.svg "android") +![Android]({{ "/img/quickstart/android-logo.svg" | relative_url }} "android") Arrow supports Android starting on API 21 and up. diff --git a/arrow-site/docs/docs/optics/README.md b/arrow-site/docs/docs/optics/README.md index 14168efb178..7993f2911dd 100644 --- a/arrow-site/docs/docs/optics/README.md +++ b/arrow-site/docs/docs/optics/README.md @@ -81,12 +81,12 @@ traversing deep values in sealed and data classes models.s Configure Arrow for your project
-![Jdk](/img/quickstart/jdk-logo.svg "jdk") +![Jdk]({{ "/img/quickstart/jdk-logo.svg" | relative_url }} "jdk") Make sure to have the latest version of JDK 1.8 installed.
-![Android](/img/quickstart/android-logo.svg "android") +![Android]({{ "/img/quickstart/android-logo.svg" | relative_url }} "android") Arrow supports Android starting on API 21 and up. diff --git a/arrow-site/docs/docs/quickstart/README.md b/arrow-site/docs/docs/quickstart/README.md index c07468229f7..1a631c8a981 100644 --- a/arrow-site/docs/docs/quickstart/README.md +++ b/arrow-site/docs/docs/quickstart/README.md @@ -38,7 +38,7 @@ Core also includes the base continuation effects system, which includes patterns Read more
-![Core](/img/quickstart/modular-libraries-core.svg "Arrow Core") +![Core]({{ "/img/quickstart/modular-libraries-core.svg" | relative_url }} "Arrow Core")
Arrow supports Android starting on API 21 and up. diff --git a/arrow-site/docs/fonts/iosevka-bold.ttf b/arrow-site/docs/fonts/iosevka-bold.ttf deleted file mode 100644 index f49579f53e1..00000000000 Binary files a/arrow-site/docs/fonts/iosevka-bold.ttf and /dev/null differ diff --git a/arrow-site/docs/fonts/iosevka-medium.ttf b/arrow-site/docs/fonts/iosevka-medium.ttf deleted file mode 100644 index 0d186f1b87b..00000000000 Binary files a/arrow-site/docs/fonts/iosevka-medium.ttf and /dev/null differ diff --git a/arrow-site/docs/fonts/iosevka-regular.ttf b/arrow-site/docs/fonts/iosevka-regular.ttf deleted file mode 100644 index 2c08b80f0bd..00000000000 Binary files a/arrow-site/docs/fonts/iosevka-regular.ttf and /dev/null differ diff --git a/arrow-site/docs/fonts/iosevka-semibold.ttf b/arrow-site/docs/fonts/iosevka-semibold.ttf deleted file mode 100644 index bf476c7501c..00000000000 Binary files a/arrow-site/docs/fonts/iosevka-semibold.ttf and /dev/null differ