diff --git a/.github/actions/check_build_and_doc/action.yml b/.github/actions/check_build_and_doc/action.yml new file mode 100644 index 000000000..ef8fed1d0 --- /dev/null +++ b/.github/actions/check_build_and_doc/action.yml @@ -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 diff --git a/.github/actions/clean_cache/action.yml b/.github/actions/clean_cache/action.yml new file mode 100644 index 000000000..86d426643 --- /dev/null +++ b/.github/actions/clean_cache/action.yml @@ -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 diff --git a/.github/actions/publish_doc/action.yml b/.github/actions/publish_doc/action.yml new file mode 100644 index 000000000..0d73f00d6 --- /dev/null +++ b/.github/actions/publish_doc/action.yml @@ -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. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e179ab989..e829f6da9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/publishTempSite.yml b/.github/workflows/publishTempSite.yml index 558be413c..d27bd5a17 100644 --- a/.github/workflows/publishTempSite.yml +++ b/.github/workflows/publishTempSite.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a789c5561..11ab8baa2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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