Skip to content

Commit

Permalink
ci: Reusable workflows need a hook, vendoring the two actions needed …
Browse files Browse the repository at this point in the history
…for now

This reverts commit bfe7970.
  • Loading branch information
krlmlr committed Aug 5, 2024
1 parent bfe7970 commit e5ddf3f
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 2 deletions.
46 changes: 44 additions & 2 deletions .github/workflows/fledge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,47 @@ concurrency:
cancel-in-progress: true

jobs:
call-dm-fledge:
uses: cynkra/dm/.github/workflows/fledge.yaml@main
check_fork:
runs-on: ubuntu-latest
outputs:
is_forked: ${{ steps.check.outputs.is_forked }}
steps:
- name: Check if the repo is forked
id: check
run: |
echo "is_forked=$(curl -s -H "Accept: application/vnd.github+json" -H 'Authorization: Bearer ${{ github.token }}' -H "X-GitHub-Api-Version: 2022-11-28" ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY} | jq .fork)" >> $GITHUB_OUTPUT
fledge:
runs-on: ubuntu-latest
needs: check_fork
if: needs.check_fork.outputs.is_forked == 'false'
permissions:
contents: write
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
FLEDGE_GHA_CI: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/workflows/git-identity

- uses: ./.github/workflows/install
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-r: false
cache-version: fledge-1
packages: cynkra/fledge

- name: Bump version
run: |
if (fledge::bump_version(which = "dev", no_change_behavior = "noop")) {
fledge::finalize_version(push = TRUE)
}
shell: Rscript {0}

- name: Check release
run: |
fledge:::release_after_cran_built_binaries()
shell: Rscript {0}
11 changes: 11 additions & 0 deletions .github/workflows/git-identity/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Actions to set up a Git identity"

runs:
using: "composite"
steps:
- name: Configure Git identity
run: |
env | sort
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
shell: bash
147 changes: 147 additions & 0 deletions .github/workflows/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: "Actions to run for installing R packages"
inputs:
token:
description: GitHub token, set to secrets.GITHUB_TOKEN
required: true
r-version:
description: Passed on to r-lib/actions/setup-r@v2
required: false
default: release
install-r:
description: Passed on to r-lib/actions/setup-r@v2
required: false
default: true
needs:
description: Passed on to r-lib/actions/setup-r-dependencies@v2
required: false
default: ""
packages:
description: Passed on to r-lib/actions/setup-r-dependencies@v2
required: false
default: deps::., any::sessioninfo
extra-packages:
description: Passed on to r-lib/actions/setup-r-dependencies@v2
required: false
default: any::rcmdcheck
cache-version:
description: Passed on to r-lib/actions/setup-r-dependencies@v2
required: false
default: 1

runs:
using: "composite"
steps:
- name: Set environment variables
run: |
echo "R_REMOTES_NO_ERRORS_FROM_WARNINGS=true" | tee -a $GITHUB_ENV
echo "R_KEEP_PKG_SOURCE=yes" | tee -a $GITHUB_ENV
echo "_R_CHECK_SYSTEM_CLOCK_=false" | tee -a $GITHUB_ENV
echo "_R_CHECK_FUTURE_FILE_TIMESTAMPS_=false" | tee -a $GITHUB_ENV
# prevent rgl issues because no X11 display is available
echo "RGL_USE_NULL=true" | tee -a $GITHUB_ENV
# from https://github.com/r-devel/r-dev-web/blob/main/CRAN/QA/Kurt/lib/R/Scripts/check_CRAN_incoming.R
echo "_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_PACKAGE_DEPENDS_IGNORE_MISSING_ENHANCES_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_CODE_CLASS_IS_STRING_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_CODOC_VARIABLES_IN_USAGES_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_CONNECTIONS_LEFT_OPEN_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_DATALIST_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_NEWS_IN_PLAIN_TEXT_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_PACKAGES_USED_CRAN_INCOMING_NOTES_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_RD_CONTENTS_KEYWORDS_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_R_DEPENDS_=warn" | tee -a $GITHUB_ENV
echo "_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_THINGS_IN_TEMP_DIR_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_UNDOC_USE_ALL_NAMES_=true" | tee -a $GITHUB_ENV
echo "_R_CHECK_URLS_SHOW_301_STATUS_=true" | tee -a $GITHUB_ENV
echo "_R_CXX_USE_NO_REMAP_=true" | tee -a $GITHUB_ENV
shell: bash

- name: Set environment variables (non-Windows only)
if: runner.os != 'Windows'
run: |
echo "_R_CHECK_BASHISMS_=true" | tee -a $GITHUB_ENV
shell: bash

- name: Update apt
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y aspell
echo "_R_CHECK_CRAN_INCOMING_USE_ASPELL_=true" | tee -a $GITHUB_ENV
shell: bash

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ inputs.r-version }}
install-r: ${{ inputs.install-r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- id: get-extra
uses: ./.github/workflows/get-extra

- uses: r-lib/actions/setup-r-dependencies@v2
env:
GITHUB_PAT: ${{ inputs.token }}
with:
pak-version: devel
needs: ${{ inputs.needs }}
packages: ${{ inputs.packages }}
extra-packages: ${{ inputs.extra-packages }} ${{ ( matrix.config.covr && 'any::covr' ) || '' }} ${{ steps.get-extra.outputs.packages }}
cache-version: ${{ inputs.cache-version }}

- name: Add pkg.lock to .gitignore
run: |
set -x
if ! [ -f .github/.gitignore ] || [ -z "$(grep '^/pkg.lock$' .github/.gitignore)" ]; then
echo /pkg.lock >> .github/.gitignore
fi
shell: bash

- name: Add fake qpdf and checkbashisms
if: runner.os == 'Linux'
run: |
sudo ln -s $(which true) /usr/local/bin/qpdf
sudo ln -s $(which true) /usr/local/bin/checkbashisms
shell: bash

- name: Install ccache
uses: krlmlr/ccache-action@parallel-dir
with:
max-size: 10G
verbose: 1
save: false
restore: false

- name: Use ccache for compiling R code, and parallelize
run: |
mkdir -p ~/.R
echo 'CC := ccache $(CC)' >> ~/.R/Makevars
echo 'CXX := ccache $(CXX)' >> ~/.R/Makevars
echo 'CXX11 := ccache $(CXX11)' >> ~/.R/Makevars
echo 'CXX14 := ccache $(CXX14)' >> ~/.R/Makevars
echo 'CXX17 := ccache $(CXX17)' >> ~/.R/Makevars
echo 'MAKEFLAGS = -j2' >> ~/.R/Makevars
cat ~/.R/Makevars
echo 'CCACHE_SLOPPINESS=locale,time_macros' | tee -a $GITHUB_ENV
# echo 'CCACHE_DEBUG=true' | tee -a $GITHUB_ENV
# echo "CCACHE_DEBUGDIR=$(dirname $(pwd))/ccache-debug" | tee -a $GITHUB_ENV
# mkdir -p $(dirname $(pwd))/.ccache-debug
echo 'PKG_BUILD_EXTRA_FLAGS=false' | tee -a $GITHUB_ENV
# Repair
git rm -rf .ccache || true
rm -rf .ccache
shell: bash

- name: Show R CMD config --all
run: |
R CMD config --all
shell: bash

0 comments on commit e5ddf3f

Please sign in to comment.