diff --git a/.github/workflows/publish.yml b/.github/workflows/_publish-code.yml similarity index 94% rename from .github/workflows/publish.yml rename to .github/workflows/_publish-code.yml index 97ccc4cd..d0753e7f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/_publish-code.yml @@ -1,8 +1,8 @@ name: Publish on: - release: - types: [ published ] + workflow_call: + workflow_dispatch: jobs: linting: diff --git a/.github/workflows/docs.yml b/.github/workflows/_publish-docs.yml similarity index 78% rename from .github/workflows/docs.yml rename to .github/workflows/_publish-docs.yml index 687d6229..247a5617 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/_publish-docs.yml @@ -1,10 +1,10 @@ +# +# Publish Documentation to GitHub pages. +# name: Publish Documentation on: - release: - types: [ published ] - - # Allows running this workflow manually from the Actions tab + workflow_call: workflow_dispatch: jobs: @@ -25,7 +25,7 @@ jobs: bundle exec rake doc - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/_build diff --git a/.github/workflows/sync-readme.yml b/.github/workflows/_publish-guide.yml similarity index 72% rename from .github/workflows/sync-readme.yml rename to .github/workflows/_publish-guide.yml index c3814875..c6ed9276 100644 --- a/.github/workflows/sync-readme.yml +++ b/.github/workflows/_publish-guide.yml @@ -1,11 +1,8 @@ -name: Sync `documentation` directory to ReadMe +name: Publish Guide to readme.com -# Run workflow for every push to the `main` branch on: + workflow_call: workflow_dispatch: - release: - branches: - - main jobs: sync: diff --git a/.github/workflows/linting.yml b/.github/workflows/_static-analysis.yml similarity index 96% rename from .github/workflows/linting.yml rename to .github/workflows/_static-analysis.yml index 241e321e..27963d31 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/_static-analysis.yml @@ -4,7 +4,7 @@ name: Static Analysis on: - - push + workflow_call: jobs: linting: diff --git a/.github/workflows/test-code-samples.yml b/.github/workflows/_test-code-samples.yml similarity index 85% rename from .github/workflows/test-code-samples.yml rename to .github/workflows/_test-code-samples.yml index debb61d0..29afe279 100644 --- a/.github/workflows/test-code-samples.yml +++ b/.github/workflows/_test-code-samples.yml @@ -1,11 +1,7 @@ name: Test Code Samples on: - pull_request: - schedule: - - cron: '0 0 * * *' - - # Allow running this workflow manually from the Actions tab + workflow_call: workflow_dispatch: jobs: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/_test-integrations.yml similarity index 68% rename from .github/workflows/integration-test.yml rename to .github/workflows/_test-integrations.yml index bae1da78..839233c8 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/_test-integrations.yml @@ -1,25 +1,29 @@ # -# Run Integration tests. +# Run integration tests. # name: Integration Tests on: - - push + workflow_call: jobs: - tests: - name: Test ${{ matrix.os }}, Ruby ${{ matrix.ruby }} + integration-tests: + name: Run Integration Tests + timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: + max-parallel: 3 matrix: os: - - "ubuntu-22.04" + - "ubuntu-24.04" + - "macos-latest" ruby: - "2.6" - "2.7" - "3.0" - "3.1" - "3.2" + - "3.3" steps: - uses: actions/checkout@v4 with: @@ -54,3 +58,13 @@ jobs: WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }} run: | bundle exec rake integration + + - name: Notify Slack Action on Failure + uses: ravsamhq/notify-slack-action@2.3.0 + if: ${{ always() && github.ref_name == 'main' }} + with: + status: ${{ job.status }} + notify_when: "failure" + notification_title: "[Ruby] Integration test '{workflow}' is failing" + env: + SLACK_WEBHOOK_URL: ${{ secrets.PRODUCTION_ISSUES_SLACK_HOOK_URL }} diff --git a/.github/workflows/test.yml b/.github/workflows/_test-units.yml similarity index 87% rename from .github/workflows/test.yml rename to .github/workflows/_test-units.yml index e5a6cfc1..68883011 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/_test-units.yml @@ -4,17 +4,18 @@ name: Tests on: - - push + workflow_call: jobs: tests: - name: Test ${{ matrix.os }}, Ruby ${{ matrix.ruby }} + name: Run Unit Tests + timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: matrix: os: + - "ubuntu-24.04" - "ubuntu-22.04" - - "ubuntu-20.04" - "macos-latest" ruby: - "2.6" @@ -22,6 +23,7 @@ jobs: - "3.0" - "3.1" - "3.2" + - "3.3" steps: - uses: actions/checkout@v4 with: @@ -37,7 +39,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt update - sudo apt-get install -y ghostscript + sudo apt-get install -y ghostscript imagemagick - name: Install Ghostscript and ImageMagick on macOS if: runner.os == 'macOS' diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 00000000..e7f14660 --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,10 @@ +name: Crontab + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + test_code_samples: + uses: mindee/mindee-api-ruby/.github/workflows/_test-code-samples.yml@main + secrets: inherit diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..a1178aeb --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,17 @@ +name: Publish Release + +on: + release: + types: [ published ] + +jobs: + publish_docs: + uses: mindee/mindee-api-ruby/.github/workflows/_publish-docs.yml@main + secrets: inherit + publish_guide: + uses: mindee/mindee-api-ruby/.github/workflows/_publish-guide.yml@main + needs: publish_docs + secrets: inherit + publish_code: + uses: mindee/mindee-api-ruby/.github/workflows/_publish-code.yml@main + secrets: inherit diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..2690f22c --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,20 @@ +name: Pull Request + +on: + pull_request: + +jobs: + static_analysis: + uses: mindee/mindee-api-ruby/.github/workflows/_static-analysis.yml@main + test_units: + uses: mindee/mindee-api-ruby/.github/workflows/_test-units.yml@main + needs: static_analysis + secrets: inherit + test_integrations: + uses: mindee/mindee-api-ruby/.github/workflows/_test-integrations.yml@main + needs: test_units + secrets: inherit + test_code_samples: + uses: mindee/mindee-api-ruby/.github/workflows/_test-code-samples.yml@main + needs: test_units + secrets: inherit diff --git a/.github/workflows/push-main-branch.yml b/.github/workflows/push-main-branch.yml new file mode 100644 index 00000000..f2cf102d --- /dev/null +++ b/.github/workflows/push-main-branch.yml @@ -0,0 +1,17 @@ +name: Push Main Branch + +on: + push: + branches: + - main + +jobs: + static_analysis: + uses: mindee/mindee-api-ruby/.github/workflows/_static-analysis.yml@main + test_units: + uses: mindee/mindee-api-ruby/.github/workflows/_test-units.yml@main + needs: static_analysis + secrets: inherit + tag: + uses: mindee/client-lib-actions/.github/workflows/tag-version.yml@main + needs: test_units