Skip to content

prep for matrix

prep for matrix #4

Workflow file for this run

on:
workflow_call:
inputs:
package:
description: Which package or commit to build (default is HEAD commit)
type: string
required: false
env:
MY_UNIVERSE: ${{ github.event.repository.name != 'cran' && format('https://{0}.r-universe.dev', github.event.repository.name) || '' }}
GH_APP_ID: '87942'
jobs:
prepare:
name: Determine package to build
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, 'Deleting packages')"
outputs:
repo_url: ${{ steps.lookup.outputs.repo_url }}
repo_name: ${{ steps.lookup.outputs.repo_name }}
repo_commit: ${{ steps.lookup.outputs.repo_commit }}
repo_subdir: ${{ steps.lookup.outputs.repo_subdir }}
repo_branch: ${{ steps.lookup.outputs.repo_branch }}
repo_registered: ${{ steps.lookup.outputs.repo_registered }}
universe_app: ${{ steps.lookup.outputs.universe_app }}
maintainer_login: ${{ steps.lookup.outputs.maintainer_login }}
build_docs: ${{ steps.lookup.outputs.build_docs }}
skip_binaries: ${{ steps.lookup.outputs.skip_binaries }}
is_rebuild: ${{ steps.lookup.outputs.is_rebuild }}
steps:
- id: lookup
name: Find changed package
uses: r-universe-org/actions/find-changes@v4
with:
github-token: ${{secrets.GITHUB_TOKEN}}
# github-token: ${{secrets.PUBLIC_PAT}}
package: ${{ inputs.package }}
pendingstatus:
name: Set Status to Pending
runs-on: ubuntu-22.04
needs: [prepare]
steps:
- name: Set upstream commit status
uses: r-universe-org/commit-status@master
env:
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
with:
repo: ${{ needs.prepare.outputs.repo_url }}
sha: ${{ needs.prepare.outputs.repo_commit }}
url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
universe: ${{ github.event.repository.name }}
has_app: ${{ needs.prepare.outputs.universe_app }}
package: ${{ needs.prepare.outputs.repo_name }}
deployed_packages: 'pending'
if: inputs.package == ''
docs:
needs: prepare
name: Build pkgdown site (ropensci only)
runs-on: ubuntu-22.04
timeout-minutes: 60
if: needs.prepare.outputs.build_docs
steps:
- name: Build package docs
uses: r-universe-org/build-docs@master
with:
repo_url: ${{ needs.prepare.outputs.repo_url }}
subdir: ${{ needs.prepare.outputs.repo_subdir }}
registry: ${{ github.event.repository.name }}
env:
GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
- name: "Save docs zip"
uses: actions/upload-artifact@v4
with:
name: docs-website
path: docs.zip
deploydocs:
name: Deploy to docs server
runs-on: ubuntu-22.04
needs: docs
steps:
- name: Get artifacts for deployment
uses: actions/download-artifact@v4
with:
name: docs-website
- id: deployment
name: Upload docs to server
uses: r-universe-org/deploy-docs@master
env:
BUILDLOG: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
GITHUB_PAT: ${{ secrets.GHPAT }}
source:
needs: prepare
name: Build source package
runs-on: ubuntu-22.04
timeout-minutes: 90
outputs:
commitinfo: ${{ steps.build.outputs.COMMITINFO }}
maintainerinfo: ${{ steps.build.outputs.MAINTAINERINFO }}
sourcepkg: ${{ steps.build.outputs.SOURCEPKG }}
package: ${{ steps.build.outputs.PACKAGE }}
version: ${{ steps.build.outputs.VERSION }}
java: ${{ steps.build.outputs.NEED_RJAVA }}
jags: ${{ steps.build.outputs.NEED_JAGS }}
cmdstan: ${{ steps.build.outputs.NEED_CMDSTAN }}
fortran: ${{ steps.build.outputs.NEED_FORTRAN }}
cargo: ${{ steps.build.outputs.NEED_CARGO }}
ostype: ${{ steps.build.outputs.OSTYPE }}
steps:
- id: build
timeout-minutes: 60
name: Build source package
uses: r-universe-org/build-source@master
env:
MAINTAINERLOGIN: ${{ needs.prepare.outputs.maintainer_login }}
GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
with:
url: ${{ needs.prepare.outputs.repo_url }}
ref: ${{ needs.prepare.outputs.repo_commit }}
subdir: ${{ needs.prepare.outputs.repo_subdir }}
branch: ${{ needs.prepare.outputs.repo_branch }}
articles: ${{ needs.prepare.outputs.repo_registered }}
- name: "Store source package"
uses: r-universe-org/actions/store-package@v4
if: ${{ always() && steps.build.outputs.PACKAGE }}
with:
name: package-source
JOB_STATUS: ${{ job.status }}
DISTRO: ${{ steps.build.outputs.DISTRO }}
FILE: ${{ steps.build.outputs.SOURCEPKG }}
TARGET: ${{ steps.build.outputs.SOURCEPKG && 'source' || 'failure' }}
- name: "Store linux binary package"
uses: r-universe-org/actions/store-package@v4
if: ${{ always() && steps.build.outputs.BINARYPKG }}
with:
name: package-linux-release
JOB_STATUS: ${{ job.status }}
DISTRO: ${{ steps.build.outputs.DISTRO }}
FILE: ${{ steps.build.outputs.BINARYPKG }}
TARGET: 'linux'
- name: "Cache package library"
uses: actions/cache/save@v4
if: ${{ always() && steps.build.outputs.BINARYPKG }}
with:
path: pkglib
key: ${{ runner.os }}-${{ github.run_id }}-${{github.run_attempt}}
wasm:
needs: [prepare, source]
if: ${{ always() && needs.source.outputs.sourcepkg }}
runs-on: ubuntu-22.04
timeout-minutes: 60
name: Build R-${{ matrix.r }} for WASM
strategy:
fail-fast: false
matrix:

Check failure on line 159 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

You have an error in your yaml syntax on line 159
r: [ 'oldrel' 'release' ]
steps:
# - name: "Restore package library"
# uses: actions/cache/restore@v4
# with:
# path: pkglib
# key: ${{ runner.os }}-${{ github.run_id }}-${{github.run_attempt}}
# restore-keys: ${{ runner.os }}-${{ github.run_id }}
- name: Download source package
uses: actions/download-artifact@v4
with:
name: package-source
path: .
- id: build
if: ${{ matrix.r == 'oldrel' }}
name: Build wasm binary
uses: r-universe-org/build-wasm@oldrel
with:
sourcepkg: ${{ needs.source.outputs.sourcepkg }}
env:
GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
# - id: build
# if: ${{ matrix.r == 'release' }}
# name: Build wasm binary
# uses: r-universe-org/build-wasm@master
# with:
# sourcepkg: ${{ needs.source.outputs.sourcepkg }}
# env:
# GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
- name: "Store package files"
uses: r-universe-org/actions/store-package@v4
if: ${{ always() && steps.build.outputs.binarypkg }}
with:
name: package-wasm-release
JOB_STATUS: ${{ job.status }}
FILE: ${{ steps.build.outputs.binarypkg }}
TARGET: "wasm"
windows:
needs: [prepare, source]
if: ${{ always() && needs.source.outputs.sourcepkg && !needs.prepare.outputs.skip_binaries }}
runs-on: windows-latest
timeout-minutes: 100
name: Build R-${{ matrix.r }} for Windows
strategy:
fail-fast: false
matrix:
r: [ 'devel', 'release', 'oldrel' ]
steps:
- name: Install R
timeout-minutes: 10
uses: r-universe-org/actions/setup-r@v4
id: install-r
with:
r-version: ${{ matrix.r }}
- name: "Prepare build tools"
uses: r-universe-org/actions/windows-prep@v4
with:
java: ${{ needs.source.outputs.java }}
jags: ${{ needs.source.outputs.jags }}
- name: Download source package
uses: actions/download-artifact@v4
with:
name: package-source
path: .
- name: "Build and check binaries"
uses: r-universe-org/actions/windows-check@v4
id: buildandcheck
timeout-minutes: 60
env:
GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
with:
sourcepkg: ${{ needs.source.outputs.sourcepkg }}
- name: "Save binary package"
uses: r-universe-org/actions/store-package@v4
if: ${{ always() && steps.buildandcheck.outputs.binarypkg }}
with:
name: package-windows-${{ matrix.r }}
JOB_STATUS: ${{ job.status }}
DISTRO: windows
FILE: ${{ steps.buildandcheck.outputs.binarypkg }}
TARGET: windows
macos:
needs: [prepare, source]
if: ${{ always() && needs.source.outputs.sourcepkg && !needs.prepare.outputs.skip_binaries }}
runs-on: macos-12
timeout-minutes: 100
name: Build R-${{ matrix.r }} for MacOS
strategy:
fail-fast: false
matrix:
r: [ 'release', 'oldrel' ]
steps:
- name: Prepare macOS system
uses: r-universe-org/actions/macos-prep@v4
with:
version: ${{ matrix.r }}
fortran: ${{ needs.source.outputs.fortran }}
jags: ${{ needs.source.outputs.jags }}
- name: Install R
timeout-minutes: 10
uses: r-universe-org/actions/setup-r@v4
id: install-r
with:
r-version: ${{ matrix.r }}
- name: Download source package
uses: actions/download-artifact@v4
with:
name: package-source
path: .
- name: "Build and check binaries"
uses: r-universe-org/actions/macos-check@v4
id: buildandcheck
timeout-minutes: 60
env:
GITHUB_PAT: ${{secrets.GITHUB_TOKEN}}
with:
sourcepkg: ${{ needs.source.outputs.sourcepkg }}
java: ${{ needs.source.outputs.java }}
jags: ${{ needs.source.outputs.jags }}
- name: "Save binary package"
uses: r-universe-org/actions/store-package@v4
if: ${{ always() && steps.buildandcheck.outputs.binarypkg }}
with:
name: package-macos-${{ matrix.r }}
JOB_STATUS: ${{ job.status }}
DISTRO: macos
FILE: ${{ steps.buildandcheck.outputs.binarypkg }}
TARGET: macos
- name: "Cross compile for MacOS ARM64"
id: crossbuild
if: always() && env.R_HOME_CROSS && steps.buildandcheck.outputs.hasplatform
uses: r-universe-org/actions/macos-cross@v4
with:
sourcepkg: ${{ needs.source.outputs.sourcepkg }}
cargo: ${{ needs.source.outputs.cargo }}
- name: "Save binary package for MacOS ARM64"
if: always() && steps.crossbuild.outputs.binarypkg
uses: r-universe-org/actions/store-package@v4
with:
name: package-macos-${{ matrix.r }}-arm64
JOB_STATUS: ${{ job.status }}
DISTRO: macos
FILE: ${{ steps.crossbuild.outputs.binarypkg }}
TARGET: macos
deploy:
name: Deploy to package server
runs-on: ubuntu-22.04
needs: [prepare, source, windows, macos, wasm, docs]
if: ${{ always() && needs.source.outputs.package }}
outputs:
deployed_packages: ${{ steps.deployment.outputs.deployed_packages }}
steps:
- name: Get artifacts for deployment
uses: actions/download-artifact@v4
- id: deployment
name: Upload packages to server
uses: r-universe-org/deploy-packages@master
env:
CRANLIKEURL: https://${{ github.event.repository.name }}.r-universe.dev/packages
CRANLIKEPWD: ${{ secrets.CRANLIKEPWD }}
PKGDOCS: ${{ needs.docs.result }}
SKIP_BINARIES: ${{ needs.prepare.outputs.skip_binaries }}
REPO_URL: ${{ needs.prepare.outputs.repo_url }}
REPO_REGISTERED: ${{ needs.prepare.outputs.repo_registered }}
COMMITINFO: ${{ needs.source.outputs.commitinfo }}
MAINTAINERINFO: ${{ needs.source.outputs.maintainerinfo }}
PACKAGE: ${{ needs.source.outputs.package }}
VERSION: ${{ needs.source.outputs.version }}
- name: Report deployment failures in slack
if: failure()
uses: r-universe-org/actions/post-slack@v4
env:
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
DEPLOY_STATUS: ${{ steps.deployment.outcome }}
finalstatus:
name: Set Github Status
runs-on: ubuntu-22.04
needs: [prepare, docs, source, deploy, pendingstatus]
if: always()
steps:
- name: Set upstream commit status
uses: r-universe-org/commit-status@master
env:
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
GITHUB_PAT: ${{secrets.GHPAT}}
with:
repo: ${{ needs.prepare.outputs.repo_url }}
sha: ${{ needs.prepare.outputs.repo_commit }}
url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
universe: ${{ github.event.repository.name }}
deployed_packages: ${{ needs.deploy.outputs.deployed_packages }}
source_status: ${{ needs.source.result }}
docs_status: ${{ needs.docs.result }}
ostype: ${{ needs.source.outputs.ostype }}
package: ${{ needs.prepare.outputs.repo_name }}
has_app: ${{ needs.prepare.outputs.universe_app }}
is_rebuild: ${{ needs.prepare.outputs.is_rebuild }}