diff --git a/.docs/AUTHORS.md b/.docs/AUTHORS.md new file mode 100644 index 00000000..38e5becd --- /dev/null +++ b/.docs/AUTHORS.md @@ -0,0 +1,17 @@ +[comment]: <> (Don't edit this file!) +[comment]: <> (It is automatically updated after every release of https://github.com/47degrees/.github) +[comment]: <> (If you want to suggest a change, please open a PR or issue in that repository) + +# Authors + +## Maintainers + +The maintainers of the project are: + +@COLLABORATORS@ + +## Contributors + +These are the people that have contributed to the _@NAME@_ project: + +@CONTRIBUTORS@ \ No newline at end of file diff --git a/.docs/CODE_OF_CONDUCT.md b/.docs/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..1cf05d1e --- /dev/null +++ b/.docs/CODE_OF_CONDUCT.md @@ -0,0 +1,22 @@ +[comment]: <> (Don't edit this file!) +[comment]: <> (It is automatically updated after every release of https://github.com/47degrees/.github) +[comment]: <> (If you want to suggest a change, please open a PR or issue in that repository) + +# Code of Conduct + +We are committed to providing a friendly, safe and welcoming +environment for all, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal +appearance, body size, race, ethnicity, age, religion, nationality, or +other such characteristics. + +Everyone is expected to follow the +[Scala Code of Conduct](https://typelevel.org/code-of-conduct.html) when +discussing the project on the available communication channels. If you +are being harassed, please contact us immediately so that we can +support you. + +## Moderation + +For any questions, concerns, or moderation requests please contact a +[member of the project](AUTHORS.md#maintainers). \ No newline at end of file diff --git a/.docs/CONTRIBUTING.md b/.docs/CONTRIBUTING.md new file mode 100644 index 00000000..f3d37329 --- /dev/null +++ b/.docs/CONTRIBUTING.md @@ -0,0 +1,31 @@ +[comment]: <> (Don't edit this file!) +[comment]: <> (It is automatically updated after every release of https://github.com/47degrees/.github) +[comment]: <> (If you want to suggest a change, please open a PR or issue in that repository) + +# Contributing + +Discussion around _@NAME@_ happens in the [GitHub issues](https://github.com/@REPO@/issues) and [pull requests](https://github.com/@REPO@/pulls). + +Feel free to open an issue if you notice a bug, have an idea for a feature, or have a question about +the code. Pull requests are also welcome. + +People are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md) when discussing _@NAME@_ on the Github page or other venues. + +If you are being harassed, please contact one of [us](AUTHORS.md#maintainers) immediately so that we can support you. In case you cannot get in touch with us please write an email to [@ORG_NAME@](mailto:@ORG_EMAIL@). + +## How can I help? + +_@NAME@_ follows a standard [fork and pull](https://help.github.com/articles/using-pull-requests/) model for contributions via GitHub pull requests. + +The process is simple: + + 1. Find something you want to work on + 2. Let us know you are working on it via GitHub issues/pull requests + 3. Implement your contribution + 4. Write tests + 5. Update the documentation + 6. Submit pull request + +You will be automatically included in the [AUTHORS.md](AUTHORS.md#contributors) file as contributor in the next release. + +If you encounter any confusion or frustration during the contribution process, please create a GitHub issue and we'll do our best to improve the process. \ No newline at end of file diff --git a/.docs/LICENSE.md b/.docs/LICENSE.md new file mode 100644 index 00000000..76b6d4ef --- /dev/null +++ b/.docs/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (C) @YEAR_RANGE@ @COPYRIGHT_OWNER@ + + 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. \ No newline at end of file diff --git a/.docs/NOTICE.md b/.docs/NOTICE.md new file mode 100644 index 00000000..d02b6520 --- /dev/null +++ b/.docs/NOTICE.md @@ -0,0 +1,9 @@ +[comment]: <> (Don't edit this file!) +[comment]: <> (It is automatically updated after every release of https://github.com/47degrees/.github) +[comment]: <> (If you want to suggest a change, please open a PR or issue in that repository) + +@NAME@ + +Copyright (c) @YEAR_RANGE@ @ORG_NAME@. All rights reserved. + +Licensed under @LICENSE@. See [LICENSE](LICENSE.md) for terms. \ No newline at end of file diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 00000000..b9e657cc --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,52 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +- name: auto-changelog + color: e01f96 + description: "Automatic update of changelog file" +- name: auto-documentation + color: cce1ff + description: "Automatic update of documentation files" +- name: auto-update + color: 63d11b + description: "Workflow, documentation templates or configuration files auto-updates" +- name: breaking-change + color: f0ff00 + description: "A breaking change that needs to be treated with consideration" +- name: bug + color: d73a4a + description: "Something isn't working" +- name: dependency-update + color: 27d14f + description: "A dependency version update" +- name: documentation + color: 0075ca + description: "Improvements or additions to documentation" +- name: duplicate + color: cfd3d7 + description: "This issue or pull request already exists" +- name: enhancement + color: a2eeef + description: "New feature or request" +- name: good first issue + color: 7057ff + description: "Good for newcomers" +- name: help wanted + color: 008672 + description: "Extra attention is needed" +- name: invalid + color: e4e669 + description: "This doesn't seem right" +- name: question + color: d876e3 + description: "Further information is requested" +- name: scala-steward + color: c6055c + description: "Dependency auto updates created by scala-steward" +- name: tests + color: 04d1c3 + description: "Improves or modifies tests" +- name: wontfix + color: ffffff + description: "This will not be worked on" \ No newline at end of file diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 00000000..87e07edd --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,9 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +enhancement: ['enhancement/*', 'feature/*'] +documentation: ['docs/*', '.docs/*', 'doc/*'] +bug: ['bug/*', 'fix/*'] +tests: ['test/*', 'tests/*'] +dependency-update: ['dep/*', 'dependency/*', 'dependency-update/*'] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..0f191622 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,31 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name-template: 'v$NEXT_PATCH_VERSION' +tag-template: 'v$NEXT_PATCH_VERSION' +exclude-labels: + - 'auto-update' + - 'auto-documentation' + - 'auto-changelog' +categories: + - title: '⚠️ Breaking changes' + label: 'breaking-change' + - title: '🚀 Features' + label: 'enhancement' + - title: '📘 Documentation' + label: 'documentation' + - title: '🐛 Bug Fixes' + label: 'bug' + - title: '📈 Dependency updates' + labels: + - 'dependency-update' + - 'scala-steward' +template: | + ## What's changed + + $CHANGES + + ## Contributors to this release + + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/bot-prs-auto-approve.yml b/.github/workflows/bot-prs-auto-approve.yml new file mode 100644 index 00000000..bf827d6c --- /dev/null +++ b/.github/workflows/bot-prs-auto-approve.yml @@ -0,0 +1,17 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Auto Approve bot PRs + +on: + pull_request + +jobs: + auto-approve: + runs-on: ubuntu-latest + steps: + - uses: hmarr/auto-approve-action@v2.0.0 + if: github.actor == '47erbot' + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..1b9c0fb9 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,72 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Update changelog + +on: + push: + tags: + - v** + +jobs: + changelog: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout project + uses: actions/checkout@v2 + with: + ref: master + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags + - name: Setup ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: '2.6' + - name: Install github-changelog-generator + run: gem install github_changelog_generator -v 1.15.0 + - name: Generate changelog + env: + repo: ${{ github.repository }} + run: | + github_changelog_generator \ + --user ${repo%/*} \ + --project ${repo#*/} \ + --token $GITHUB_TOKEN \ + --exclude-labels "duplicate,question,invalid,wontfix,auto-update,auto-changelog,auto-documentation" \ + --max-issues 1000 \ + --configure-sections \ + '{ + "breaking": { + "prefix": "⚠️ **Breaking changes**", + "labels": ["breaking-change"] + }, + "enhancement": { + "prefix": "🚀 **Features**", + "labels": ["enhancement"] + }, + "documentation": { + "prefix": "📘 **Documentation**", + "labels": ["documentation"] + }, + "bug": { + "prefix": "🐛 **Bug Fixes**", + "labels": ["bug"] + }, + "dependency": { + "prefix": "📈 **Dependency updates**", + "labels": ["dependency-update", "scala-steward"] + } + }' + - name: Create Changelog Pull Request + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + commit-message: Update CHANGELOG.md [ci skip] + title: 'Update CHANGELOG.md' + labels: auto-changelog + branch: auto-update-changelog + body: Update CHANGELOG.md with information from latest release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..78f8c4c8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Formatters & Tests + +on: + push: + branches: master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} + REQUIRES_JEKYLL_CI: ${{secrets.REQUIRES_JEKYLL_CI}} + REQUIRES_CODECOV: ${{secrets.REQUIRES_CODECOV}} + steps: + - name: Checkout project + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Set up jekyll + if: env.REQUIRES_JEKYLL_CI != null + run: | + gem install jekyll -v 4 + - name: Set up codecov + if: env.REQUIRES_CODECOV != null + run: | + curl -s https://codecov.io/bash > .codecov + chmod +x .codecov + - name: Setup Scala + uses: olafurpg/setup-scala@v7 + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.cache/coursier/v1 + key: ${{ runner.os }}-coursier-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-coursier- + - name: Cache .sbt + uses: actions/cache@v1 + with: + path: ~/.sbt + key: ${{ runner.os }}-sbt-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-sbt- + - name: Run checks + run: sbt ci-test + - name: Upload codecov reports + if: env.REQUIRES_CODECOV != null + run: | + ./.codecov -X gcov diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..7a72f263 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,51 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Update documentation + +on: + push: + branches: master + tags: v** + +jobs: + documentation: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} + steps: + - name: Checkout project + uses: actions/checkout@v2 + with: + ref: master + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags + - name: Setup Scala + uses: olafurpg/setup-scala@v7 + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.cache/coursier/v1 + key: ${{ runner.os }}-coursier-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-coursier- + - name: Cache .sbt + uses: actions/cache@v1 + with: + path: ~/.sbt + key: ${{ runner.os }}-sbt-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-sbt- + - name: Generate documentation + run: sbt ci-docs + env: + DOWNLOAD_INFO_FROM_GITHUB: true + - name: Create Documentation Pull Request + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + commit-message: Update documentation and other files + title: 'Update documentation and other files' + labels: auto-documentation + branch: auto-update-docs + body: Update documentation and other files with latest changes. diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 00000000..be1bd145 --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,17 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: PR Labeler +on: + pull_request: + types: [opened] + +jobs: + pr-labeler: + runs-on: ubuntu-latest + steps: + - name: Label PR + uses: TimonVS/pr-labeler-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish-microsite.yml b/.github/workflows/publish-microsite.yml new file mode 100644 index 00000000..63cb2cde --- /dev/null +++ b/.github/workflows/publish-microsite.yml @@ -0,0 +1,46 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Publish Microsite + +on: + push: + tags: v** + +jobs: + microsite: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REQUIRES_PUBLISH_MICROSITE: ${{secrets.REQUIRES_PUBLISH_MICROSITE}} + steps: + - name: Checkout project + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup Scala + uses: olafurpg/setup-scala@v7 + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Set up jekyll + if: env.REQUIRES_PUBLISH_MICROSITE != null + run: | + gem install jekyll -v 4 + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.cache/coursier/v1 + key: ${{ runner.os }}-coursier-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-coursier- + - name: Cache .sbt + uses: actions/cache@v1 + with: + path: ~/.sbt + key: ${{ runner.os }}-sbt-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-sbt- + - name: Publish Microsite + if: env.REQUIRES_PUBLISH_MICROSITE != null + run: sbt ci-microsite diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..fa43efbf --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Release Drafter + +on: + push: + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - name: Update release draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..de3aaeac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Release + +on: + push: + branches: master + tags: v** + +jobs: + release: + runs-on: ubuntu-latest + env: + DOWNLOAD_INFO_FROM_GITHUB: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + REQUIRES_PUBLISH_MICROSITE: ${{secrets.REQUIRES_PUBLISH_MICROSITE}} + steps: + - name: Checkout project + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags + - name: Setup Scala + uses: olafurpg/setup-scala@v7 + - name: Setup GPG + uses: olafurpg/setup-gpg@v2 + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.cache/coursier/v1 + key: ${{ runner.os }}-coursier-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-coursier- + - name: Cache .sbt + uses: actions/cache@v1 + with: + path: ~/.sbt + key: ${{ runner.os }}-sbt-${{ hashFiles('build.sbt') }}-${{ hashFiles('project/*.scala') }} + restore-keys: ${{ runner.os }}-sbt- + - name: Release new version + if: env.SONATYPE_USERNAME != null + run: sbt ci-release diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml new file mode 100644 index 00000000..8130f601 --- /dev/null +++ b/.github/workflows/update-labels.yml @@ -0,0 +1,21 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +name: Github Labeler + +on: + push: + paths: + - '.github/labels.yml' + +jobs: + github-labeler: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Github Labeler + uses: crazy-max/ghaction-github-labeler@v1.1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7ec9a6a3..e92a4294 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,70 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + +### Intellij ### + +.idea +out/ + +### Java ### + *.class *.log -# sbt specific -.cache -.history -.lib/ +### macOS ### + +.DS_Store + +### SBT ### + dist/* target/ lib_managed/ src_managed/ project/boot/ project/plugins/project/ +.history +.cache +.lib/ -# ensime -.ensime -.ensime_cache/ -ensime.sbt +### Scala ### -# Scala-IDE specific -.scala_dependencies -.worksheet -.idea +*.metals +.bloop/ +.metals/ +project/.bloop/ +project/metals.sbt -# Ensime -.ensime +### Vim ### -# OSX -.DS_Store +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] -.metals/ +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist + +# Auto-generated tag files +tags + +# Persistent undo +[._]*.un~ + +# Coc configuration directory +.vim + +### VisualStudioCode ### -secret_key.asc +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/.mergify.yml b/.mergify.yml index d7948184..9103531d 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,9 +1,26 @@ +# Don't edit this file! +# It is automatically updated after every release of https://github.com/47degrees/.github +# If you want to suggest a change, please open a PR or issue in that repository + pull_request_rules: - - name: Automatic merge scala-steward PRs when CI is passing + - name: automatically merge & label scala-steward's PRs conditions: - author=scala-steward - - status-success=continuous-integration/travis-ci/pr - - body~=labels:.*semver-patch + - status-success=test actions: merge: - method: merge + method: squash + label: + add: [scala-steward] + - name: automatically merge & label 47erbot's PRs + conditions: + - author=47erbot + - status-success=test + actions: + merge: + method: squash + - name: delete head branch after merge + conditions: + - merged + actions: + delete_head_branch: {} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4fba1735..00000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: scala -sudo: required -services: -- docker -scala: -- 2.13.1 -jdk: -- openjdk8 -cache: - directories: - - $HOME/.coursier/cache - - $HOME/.ivy2/cache - - $HOME/.sbt/boot/ -env: - global: JAVA_OPTS=-Xmx2g SBT_OPTS="-XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m" -script: -- sbt ++$TRAVIS_SCALA_VERSION test - -before_install: -- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then - openssl aes-256-cbc -K $encrypted_98b97a2f355e_key -iv $encrypted_98b97a2f355e_iv -in secret_key.asc.enc -out secret_key.asc -d; - gpg --import --batch --passphrase "$PGP_PASSPHRASE" secret_key.asc; - fi - -after_success: -- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" -a "$TRAVIS_SCALA_VERSION" = "2.13.1" ]; then - sbt ++$TRAVIS_SCALA_VERSION publishSignedAll; - echo "Deploying to Heroku"; - docker login --username=noel.m@47deg.com --password=$heroku_token registry.heroku.com; - sbt ++$TRAVIS_SCALA_VERSION dockerBuildAndPush; - sbt ++$TRAVIS_SCALA_VERSION smoketests/test; - fi -- if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then - echo "Not in master branch, skipping deploy and release"; - fi diff --git a/build.sbt b/build.sbt index 5668b1ed..c11c086d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,6 @@ +addCommandAlias("ci-test", "scalafmtCheck; scalafmtSbtCheck; test") +addCommandAlias("ci-docs", "project-docs/mdoc") + Universal / javaOptions += "-Dscala.classpath.closeZip=true" lazy val `evaluator-server` = (project in file("server")) @@ -15,7 +18,7 @@ lazy val `evaluator-server` = (project in file("server")) .settings(buildInfoSettings: _*) .settings(serverScalaMacroDependencies: _*) -lazy val `smoketests` = (project in file("smoketests")) +lazy val smoketests = (project in file("smoketests")) .dependsOn(`evaluator-server`) .enablePlugins(BuildInfoPlugin) .settings(noPublishSettings: _*) @@ -30,10 +33,13 @@ lazy val root = (project in file(".")) .settings(stage := (stage in Universal in `evaluator-server`).value) .settings(noPublishSettings: _*) .aggregate(`evaluator-server`) + .dependsOn(`evaluator-server`) -addCommandAlias( - "publishSignedAll", - ";evaluator-sharedJS/publishSigned;evaluator-sharedJVM/publishSigned;evaluator-clientJS/publishSigned;evaluator-clientJVM/publishSigned" -) - -pgpPassphrase := Some(getEnvVar("PGP_PASSPHRASE").getOrElse("").toCharArray) +lazy val `project-docs` = (project in file(".docs")) + .aggregate(`evaluator-server`, smoketests) + .dependsOn(`evaluator-server`, smoketests) + .settings(moduleName := "evaluator-project-docs") + .settings(mdocIn := file(".docs")) + .settings(mdocOut := file(".")) + .settings(skip in publish := true) + .enablePlugins(MdocPlugin) diff --git a/project/plugins.sbt b/project/plugins.sbt index a024ff11..e86f1b01 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,10 @@ resolvers += Resolver.sonatypeRepo("snapshots") -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.0") -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") -addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.5.0") -addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.13.3") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.0") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") +addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.5.0") +addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.13.3") +addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.5") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.3") +addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % "0.2") diff --git a/secret_key.asc.enc b/secret_key.asc.enc deleted file mode 100644 index 743aeb30..00000000 Binary files a/secret_key.asc.enc and /dev/null differ diff --git a/server/src/main/scala/org/scalaexercises/evaluator/evaluation.scala b/server/src/main/scala/org/scalaexercises/evaluator/evaluation.scala index dec69d78..dea73f77 100644 --- a/server/src/main/scala/org/scalaexercises/evaluator/evaluation.scala +++ b/server/src/main/scala/org/scalaexercises/evaluator/evaluation.scala @@ -455,9 +455,7 @@ class ${className} extends (() => Any) with java.io.Serializable { case ncp => ncp .split(" ") - .map { f => - new File(relativeRoot, f).getAbsolutePath - } + .map(f => new File(relativeRoot, f).getAbsolutePath) .toList }.unsafeRunSync diff --git a/server/src/test/scala/org/scalaexercises/evaluator/EvalEndpointSpec.scala b/server/src/test/scala/org/scalaexercises/evaluator/EvalEndpointSpec.scala index 5814d472..fc498d3e 100644 --- a/server/src/test/scala/org/scalaexercises/evaluator/EvalEndpointSpec.scala +++ b/server/src/test/scala/org/scalaexercises/evaluator/EvalEndpointSpec.scala @@ -95,9 +95,10 @@ class EvalEndpointSpec extends AnyFunSpec with Matchers with Implicits { EvalRequest( code = "{import cats._; Eval.now(42).value}", resolvers = commonResolvers, - dependencies = List(Dependency("org.typelevel", "cats-core_2.13", "2.0.0")) ++ scalaDependencies( - Scala213 - ) + dependencies = + List(Dependency("org.typelevel", "cats-core_2.13", "2.0.0")) ++ scalaDependencies( + Scala213 + ) ), `X-Scala-Eval-Api-Token`(validToken) ), @@ -117,9 +118,10 @@ class EvalEndpointSpec extends AnyFunSpec with Matchers with Implicits { EvalRequest( code = code, resolvers = resolvers, - dependencies = List(Dependency("org.typelevel", "cats-core_2.13", version)) ++ scalaDependencies( - Scala213 - ) + dependencies = + List(Dependency("org.typelevel", "cats-core_2.13", version)) ++ scalaDependencies( + Scala213 + ) ), `X-Scala-Eval-Api-Token`(validToken) ), diff --git a/smoketests/src/test/scala/org/scalaexercises/evaluator/Smoketests.scala b/smoketests/src/test/scala/org/scalaexercises/evaluator/Smoketests.scala index 5e59e20c..3bd05219 100644 --- a/smoketests/src/test/scala/org/scalaexercises/evaluator/Smoketests.scala +++ b/smoketests/src/test/scala/org/scalaexercises/evaluator/Smoketests.scala @@ -29,15 +29,20 @@ class Smoketests extends AnyFunSpec with Matchers with CirceInstances with Impli case _ => Uri.fromString("https://scala-evaluator-212.herokuapp.com/eval") }) .handleErrorWith(_ => - IO.raiseError(new RuntimeException( - s"Unable to parse the scala evaluator url for scala version ${BuildInfo.scalaVersion}"))) + IO.raiseError( + new RuntimeException( + s"Unable to parse the scala evaluator url for scala version ${BuildInfo.scalaVersion}" + ) + ) + ) .unsafeRunSync() case class EvaluatorResponse( msg: String, value: String, valueType: String, - compilationInfos: Map[String, String]) + compilationInfos: Map[String, String] + ) implicit def decoder[F[_]: Sync]: EntityDecoder[F, EvaluatorResponse] = jsonOf[F, EvaluatorResponse] @@ -45,9 +50,9 @@ class Smoketests extends AnyFunSpec with Matchers with CirceInstances with Impli val validToken = Jwt.encode("""{"user": "scala-exercises"}""", auth.secretKey, JwtAlgorithm.HS256) - def makeRequest(code: String)( - expectation: EvaluatorResponse => Unit, - failExpectation: Throwable => Unit = fail(_)): Unit = { + def makeRequest( + code: String + )(expectation: EvaluatorResponse => Unit, failExpectation: Throwable => Unit = fail(_)): Unit = { val request = Request[IO](method = Method.POST, uri = evaluatorUrl) .withEntity(s"""{"resolvers" : [], "dependencies" : [], "code" : "$code"}""") @@ -72,9 +77,7 @@ class Smoketests extends AnyFunSpec with Matchers with CirceInstances with Impli describe("Querying the /eval endpoint") { it("should succeed for a simple request") { - makeRequest("1 + 1") { evaluatorResponse => - evaluatorResponse.value shouldBe "2" - } + makeRequest("1 + 1")(evaluatorResponse => evaluatorResponse.value shouldBe "2") } it("should continue to work after calling System.exit") { @@ -83,9 +86,7 @@ class Smoketests extends AnyFunSpec with Matchers with CirceInstances with Impli failExpectation = _ => () ) - makeRequest("1 + 1") { evaluatorResponse => - evaluatorResponse.value shouldBe "2" - } + makeRequest("1 + 1")(evaluatorResponse => evaluatorResponse.value shouldBe "2") } it("should not expose sensitive details by calling sys.env") { diff --git a/version.sbt b/version.sbt deleted file mode 100644 index 3f478e0c..00000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version in ThisBuild := "0.6.0-SNAPSHOT"