From 819e7d59c8efd3ad01fe3476e1b284902fa5e749 Mon Sep 17 00:00:00 2001 From: Felix MIL Date: Wed, 3 Jul 2024 18:09:43 +0200 Subject: [PATCH] Add a workflow step to increase dev version automatically + refactor all jobs in one main workflow --- .github/workflows/R-CMD-check.yaml | 18 --------- .github/workflows/increase-dev-version.yaml | 37 ++++++++++++++++++ .github/workflows/main-workflow.yaml | 42 +++++++++++++++++++++ .github/workflows/pkgdown.yaml | 18 --------- .github/workflows/test-coverage.yaml | 18 --------- 5 files changed, 79 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/R-CMD-check.yaml create mode 100644 .github/workflows/increase-dev-version.yaml create mode 100644 .github/workflows/main-workflow.yaml delete mode 100644 .github/workflows/pkgdown.yaml delete mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml deleted file mode 100644 index cd0bb75c4..000000000 --- a/.github/workflows/R-CMD-check.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: R-CMD-check-build - -on: - push: - branches: [main, master, develop] - pull_request: - branches: [main, master, develop] - workflow_dispatch: - -jobs: - R-CMD-check-build: - uses: Open-Systems-Pharmacology/Workflows/.github/workflows/R-CMD-check-build.yml@main - with: - install-pksim: true - install-rClr: true - extra-packages: | - ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils - tlf=github::Open-Systems-Pharmacology/TLF-Library diff --git a/.github/workflows/increase-dev-version.yaml b/.github/workflows/increase-dev-version.yaml new file mode 100644 index 000000000..e0991c9df --- /dev/null +++ b/.github/workflows/increase-dev-version.yaml @@ -0,0 +1,37 @@ +name: increase-dev-version + +on: + workflow_call: + +jobs: + change-version: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: write-all + steps: + - uses: actions/checkout@v4 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install packages + run: | + install.packages("usethis") + shell: Rscript {0} + + - name: Change DESCRIPTION file + run: | + if(usethis:::is_dev_version()){ + desc::desc_set_version(version = usethis:::bump_version()[["dev"]]) + } + shell: Rscript {0} + + - uses: EndBug/add-and-commit@v9 + if: ${{ success() }} + with: + message: '🤖 Bump development version.' + default_author: github_actions + add: 'DESCRIPTION' diff --git a/.github/workflows/main-workflow.yaml b/.github/workflows/main-workflow.yaml new file mode 100644 index 000000000..5cd421120 --- /dev/null +++ b/.github/workflows/main-workflow.yaml @@ -0,0 +1,42 @@ +name: Main-Workflow + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + + +jobs: + increase-dev-version: # only do that when actually merging in main/develop branch + if: github.event_name != 'pull_request' + uses: ./.github/workflows/increase-dev-version.yaml + R-CMD-Check: + if: ${{ always() }} + uses: Open-Systems-Pharmacology/Workflows/.github/workflows/R-CMD-check-build.yml@main + with: + install-pksim: true + install-rClr: true + extra-packages: | + ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils + tlf=github::Open-Systems-Pharmacology/TLF-Library + test-coverage: + if: ${{ always() }} + needs: [R-CMD-Check] + uses: Open-Systems-Pharmacology/Workflows/.github/workflows/test-pkg-and-coverage.yml@main + with: + install-pksim: true + install-rClr: true + extra-packages: | + ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils + tlf=github::Open-Systems-Pharmacology/TLF-Library + pkgdown: + if: ${{ always() }} + needs: [R-CMD-Check] + uses: Open-Systems-Pharmacology/Workflows/.github/workflows/pkgdown.yml@main + with: + install-pksim: true + install-rClr: true + extra-packages: | + ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils + tlf=github::Open-Systems-Pharmacology/TLF-Library diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml deleted file mode 100644 index 69c2f9863..000000000 --- a/.github/workflows/pkgdown.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: pkgdown - -on: - push: - branches: [main, master, develop] - pull_request: - branches: [main, master, develop] - workflow_dispatch: - -jobs: - pkgdown: - uses: Open-Systems-Pharmacology/Workflows/.github/workflows/pkgdown.yml@main - with: - install-pksim: true - install-rClr: true - extra-packages: | - ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils - tlf=github::Open-Systems-Pharmacology/TLF-Library diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml deleted file mode 100644 index e5e36d767..000000000 --- a/.github/workflows/test-coverage.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: test-pkg-and-coverage - -on: - push: - branches: [main, master, develop] - pull_request: - branches: [main, master, develop] - workflow_dispatch: - -jobs: - test-pkg-and-coverage: - uses: Open-Systems-Pharmacology/Workflows/.github/workflows/test-pkg-and-coverage.yml@main - with: - install-pksim: true - install-rClr: true - extra-packages: | - ospsuite.utils=github::Open-Systems-Pharmacology/OSPSuite.RUtils - tlf=github::Open-Systems-Pharmacology/TLF-Library