From 97304e040142756a2ed4200fb5ae1c88786ee1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 6 Dec 2024 09:06:49 +0100 Subject: [PATCH] ci: Use stable pak (#17) * ci: Use stable pak * ci: Correctly detect branch protection * ci: Use Ubuntu 24.04 and styler PR * ci: Use Ubuntu 24.04 for fledge, squash * ci: Fix macOS (#16) * ci: Need to install R on Ubuntu 24.04 * ci: Need to install R on Ubuntu 24.04 for fledge * ci: Use styler from main branch * ci: Explicit permissions * ci: Ignore errors when removing pkg-config on macOS * ci: Use larger retry count for lock-threads workflow --- .github/workflows/R-CMD-check-dev.yaml | 4 ---- .github/workflows/R-CMD-check-status.yaml | 2 +- .github/workflows/R-CMD-check.yaml | 5 ++--- .github/workflows/fledge.yaml | 23 ++++++++++++++++------- .github/workflows/install/action.yml | 8 +++++++- .github/workflows/lock.yaml | 10 +++++++--- .github/workflows/pkgdown.yaml | 3 +-- .github/workflows/pr-commands.yaml | 4 ---- 8 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/R-CMD-check-dev.yaml b/.github/workflows/R-CMD-check-dev.yaml index 700486f..bb87451 100644 --- a/.github/workflows/R-CMD-check-dev.yaml +++ b/.github/workflows/R-CMD-check-dev.yaml @@ -27,8 +27,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: r-lib/actions/setup-r@v2 - with: - install-r: false - id: set-matrix uses: ./.github/workflows/dep-matrix @@ -70,7 +68,6 @@ jobs: - uses: ./.github/workflows/install with: - install-r: false cache-version: rcc-dev-base-1 needs: check extra-packages: "any::rcmdcheck any::remotes ." @@ -118,7 +115,6 @@ jobs: - uses: ./.github/workflows/install with: - install-r: false cache-version: rcc-dev-${{ matrix.package }}-1 needs: check extra-packages: "any::rcmdcheck any::remotes ." diff --git a/.github/workflows/R-CMD-check-status.yaml b/.github/workflows/R-CMD-check-status.yaml index b9bdf4e..7a4ea62 100644 --- a/.github/workflows/R-CMD-check-status.yaml +++ b/.github/workflows/R-CMD-check-status.yaml @@ -12,7 +12,7 @@ name: rcc-status jobs: rcc-status: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: "Update commit status" diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2af0024..41ae8a5 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -43,7 +43,7 @@ name: rcc jobs: rcc-smoke: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: sha: ${{ steps.commit.outputs.sha }} versions-matrix: ${{ steps.versions-matrix.outputs.matrix }} @@ -205,7 +205,7 @@ jobs: shell: bash rcc-smoke-check-matrix: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: "Check matrix" @@ -294,7 +294,6 @@ jobs: - uses: ./.github/workflows/install with: - install-r: false cache-version: rcc-dev-${{ matrix.package }}-1 needs: check extra-packages: "any::rcmdcheck any::remotes ." diff --git a/.github/workflows/fledge.yaml b/.github/workflows/fledge.yaml index 02e9101..7785ad9 100644 --- a/.github/workflows/fledge.yaml +++ b/.github/workflows/fledge.yaml @@ -19,7 +19,7 @@ concurrency: jobs: check_fork: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: is_forked: ${{ steps.check.outputs.is_forked }} steps: @@ -33,7 +33,7 @@ jobs: shell: bash fledge: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: check_fork if: needs.check_fork.outputs.is_forked == 'false' permissions: @@ -61,7 +61,6 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - install-r: false use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 @@ -72,8 +71,18 @@ jobs: packages: cynkra/fledge cache-version: fledge-1 + - name: Count rulesets + # Assume that branch is protected if ruleset exists + id: rulesets + env: + GH_TOKEN: ${{ github.token }} + run: | + n_rulesets=$(gh api repos/${{ github.repository }}/rulesets -q length) + echo "count=${n_rulesets}" >> $GITHUB_OUTPUT + shell: bash + - name: Switch to branch if branch protection is enabled - if: github.ref_protected == 'true' || inputs.pr == 'true' + if: github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0 run: | git checkout -b fledge git push -f -u origin HEAD @@ -83,21 +92,21 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} run: | - check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' }}" != "true") + check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0 }}" != "true") if (fledge::bump_version(which = "dev", no_change_behavior = "noop", check_default_branch = check_default_branch)) { fledge::finalize_version(push = TRUE) } shell: Rscript {0} - name: Create and merge PR if branch protection is enabled - if: github.ref_protected == 'true' || inputs.pr == 'true' + if: github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -x gh pr create --base main --head fledge --fill-first gh workflow run rcc -f ref=$(git rev-parse HEAD) - gh pr merge --merge --auto + gh pr merge --squash --auto shell: bash - name: Check release diff --git a/.github/workflows/install/action.yml b/.github/workflows/install/action.yml index 263ddf3..03bcb1e 100644 --- a/.github/workflows/install/action.yml +++ b/.github/workflows/install/action.yml @@ -75,6 +75,12 @@ runs: echo "_R_CHECK_CRAN_INCOMING_USE_ASPELL_=true" | tee -a $GITHUB_ENV shell: bash + - name: Remove pkg-config@0.29.2 + if: runner.os == 'macOS' + run: | + brew uninstall pkg-config@0.29.2 || true + shell: bash + - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 @@ -95,7 +101,7 @@ runs: env: GITHUB_PAT: ${{ inputs.token }} with: - pak-version: devel + pak-version: stable needs: ${{ inputs.needs }} packages: ${{ inputs.packages }} extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.config.covr && 'any::covr' ) || '' }} ${{ steps.get-extra.outputs.packages }} diff --git a/.github/workflows/lock.yaml b/.github/workflows/lock.yaml index e2a367f..2cd4837 100644 --- a/.github/workflows/lock.yaml +++ b/.github/workflows/lock.yaml @@ -1,14 +1,18 @@ name: "Lock threads" - +permissions: + issues: write + pull-requests: write + discussions: write on: + workflow_dispatch: schedule: - cron: "37 2 * * *" jobs: lock: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: dessant/lock-threads@v5 + - uses: krlmlr/lock-threads@patch-1 with: github-token: ${{ github.token }} issue-inactive-days: "365" diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index de69b14..60d1849 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -16,7 +16,7 @@ concurrency: jobs: pkgdown: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: "pkgdown" @@ -39,7 +39,6 @@ jobs: - uses: ./.github/workflows/install with: token: ${{ secrets.GITHUB_TOKEN }} - install-r: false cache-version: pkgdown-2 needs: website extra-packages: r-lib/pkgdown local::. diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index a11f4d3..b07a6f3 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -16,8 +16,6 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: r-lib/actions/setup-r@v2 - with: - install-r: false - name: Configure Git identity run: | env | sort @@ -55,8 +53,6 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: r-lib/actions/setup-r@v2 - with: - install-r: false - name: Configure Git identity run: | env | sort