Skip to content
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

ci: [+] compose actions (issue #152) #171

Merged
merged 1 commit into from
Mar 8, 2022
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
35 changes: 35 additions & 0 deletions .github/actions/check_build_and_doc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Check, build & doc 🎯"
description: "Check the code, build, testing & generate project documentation"

inputs:
testing:
description: 'Whether to execute tests or not'
required: false
default: true

runs:
using: "composite"
steps:
- uses: olafurpg/setup-scala@v13
- uses: coursier/cache-action@v6
- name: Code Format
if: inputs.testing == 'true'
run: sbt scalafmtCheckAll
shell: bash
- name: Test & coverage 📋
if: inputs.testing == 'true'
run: sbt coverage core/test coverageReport coverageAggregate
shell: bash
- name: Publish coverage to codecov 📊
if: inputs.testing == 'true'
uses: codecov/codecov-action@v2
with:
files: ./target/scala-2.12/scoverage-report/scoverage.xml
fail_ci_if_error: true
verbose: false
- name: Build the microsite 💻
run: sbt docs/mdoc
shell: bash
- name: Build the scaladocs 💻
run: sbt core/doc
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/clean_cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Cleaning for cache 🚯"
description: "Clean cache"

runs:
using: "composite"
steps:
- name: Cleaning for cache 🚯
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
shell: bash
16 changes: 16 additions & 0 deletions .github/actions/publish_doc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Publish documentation 📑"
description: "Clean cache"

runs:
using: "composite"
steps:
- name: Copy site and docs to gh-pages branch 💾
run: |
mkdir -p docs/target/mdoc/docs/api/latest
cp -ar core/target/scala-2.12/api/* docs/target/mdoc/docs/api/latest/
shell: bash
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.2
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/target/mdoc # The folder the action should deploy.
27 changes: 4 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Code Format
run: sbt scalafmtCheckAll
- name: Test & coverage
run: sbt coverage core/test coverageReport coverageAggregate
- uses: codecov/codecov-action@v2
with:
files: ./target/scala-2.12/scoverage-report/scoverage.xml
fail_ci_if_error: true
verbose: false
- name: Check the microsite
run: sbt docs/mdoc
- name: Check the scaladocs
run: sbt core/doc
- name: Cleaning for cache
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
- name: Check, build and doc 🎯
uses: ./.github/actions/check_build_and_doc
- name: Cleaning for cache 🚯
uses: ./.github/actions/clean_cache
33 changes: 8 additions & 25 deletions .github/workflows/publishTempSite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,17 @@ concurrency:

jobs:
publish:
if: github.GITHUB_REPOSITORY != 'hablapps/doric'
if: github.repository != 'hablapps/doric'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Build the microsite
run: |
sbt docs/mdoc
- name: Build the scaladocs
run: |
sbt core/doc
- name: Copy site and docs to gh-pages branch
run: |
mkdir -p docs/target/mdoc/docs/api/latest
cp -ar core/target/scala-2.12/api/* docs/target/mdoc/docs/api/latest/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.5
- name: Check, build and doc 🎯
uses: ./.github/actions/check_build_and_doc
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/target/mdoc # The folder the action should deploy.
- name: Cleaning for cache
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
testing: false
- name: Publish documentation 📑
uses: ./.github/actions/publish_doc
- name: Cleaning for cache 🚯
uses: ./.github/actions/clean_cache
41 changes: 8 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,16 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
- name: Coursier cache
uses: coursier/cache-action@v6
- run: sbt ci-release
- name: Check, build and doc 🎯
uses: ./.github/actions/check_build_and_doc
- name: Publish documentation 📑
uses: ./.github/actions/publish_doc
- name: Maven release 🎁
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: Test & coverage
run: sbt coverage core/test coverageReport coverageAggregate
- uses: codecov/codecov-action@v2
with:
files: ./target/scala-2.12/scoverage-report/scoverage.xml
fail_ci_if_error: true
verbose: false
- name: Build the microsite
run: |
sbt docs/mdoc
- name: Build the scaladocs
run: |
sbt core/doc
- name: Copy site and docs to gh-pages branch
run: |
mkdir -p docs/target/mdoc/docs/api/latest
cp -ar core/target/scala-2.12/api/* docs/target/mdoc/docs/api/latest/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/target/mdoc # The folder the action should deploy.
- name: Cleaning for cache
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
- name: Cleaning for cache 🚯
uses: ./.github/actions/clean_cache