diff --git a/.github/workflows/build-deploy-tarball.yaml b/.github/workflows/build-deploy-tarball.yaml new file mode 100644 index 0000000..a06f437 --- /dev/null +++ b/.github/workflows/build-deploy-tarball.yaml @@ -0,0 +1,133 @@ +name: Release Candidate + +on: + pull_request: + branches: [ "main" ] + +jobs: + # ----------------------------------------------------------------------------- + # JOB 1: Build Artifact + # ----------------------------------------------------------------------------- + build: + if: github.head_ref == 'package-pre_prod' + runs-on: ubuntu-latest + outputs: + tarball: ${{ steps.pkg_info.outputs.tarball }} + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + # Installs devtools AND system libraries (libcurl, etc.) + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: | + devtools + desc + + - name: Build with devtools + id: pkg_info + run: | + # 1. Clean up old files (R syntax) + unlink(list.files(pattern = "\\.tar\\.gz$")) + + # 2. Build + devtools::build(path = ".") + + # 3. Capture filename (R syntax) + tarball_name <- list.files(pattern = "\\.tar\\.gz$")[1] + + # 4. Save to GitHub Output (R syntax) + cat(paste0("tarball=", tarball_name, "\n"), file = Sys.getenv("GITHUB_OUTPUT")) + shell: Rscript {0} + + - name: Save Artifact + uses: actions/upload-artifact@v4 + with: + name: cran-tarball + path: ${{ steps.pkg_info.outputs.tarball }} + + # ----------------------------------------------------------------------------- + # JOB 2: WinBuilder + # ----------------------------------------------------------------------------- + winbuilder: + needs: build + runs-on: ubuntu-latest + steps: + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + use-public-rspm: true # Speeds up installation + + # ADDED: Ensures devtools installs without missing system library errors + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: devtools + + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: cran-tarball + path: . + + - name: Submit to WinBuilder + run: | + pkg_tarball <- "${{ needs.build.outputs.tarball }}" + print(paste("Submitting", pkg_tarball)) + + tryCatch( + devtools::check_win_release(pkg = pkg_tarball), + error = function(e) message("Release upload failed: ", e$message) + ) + + tryCatch( + devtools::check_win_devel(pkg = pkg_tarball), + error = function(e) message("Devel upload failed: ", e$message) + ) + shell: Rscript {0} + + # ----------------------------------------------------------------------------- + # JOB 3: Validate + # ----------------------------------------------------------------------------- + validate: + needs: build + runs-on: ${{ matrix.os }} + strategy: + #fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + + steps: + # Checkout is REQUIRED for setup-r-dependencies to read your DESCRIPTION file + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + use-public-rspm: true + + # ADDED: Installs dependencies safely on Linux (handles system libs like libxml2) + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + needs: check + + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: cran-tarball + path: . + + - name: Install & Verify + run: | + pkg_tarball <- "${{ needs.build.outputs.tarball }}" + + # Install the tarball + install.packages(pkg_tarball, repos = NULL, type = "source") + + # Test load + library(gsub("_.*", "", pkg_tarball), character.only = TRUE) + print("SUCCESS: Package installed and loaded.") + shell: Rscript {0} diff --git a/README.md b/README.md index d628077..0a74721 100644 --- a/README.md +++ b/README.md @@ -113,14 +113,14 @@ fit_et <- nmar( summary(fit_et) #> NMAR Model Summary (Exponential tilting) #> ================================= -#> y mean: -1.003956 +#> y mean: -1.003974 #> Converged: TRUE #> Variance method: none #> Call: nmar(y ~ x, data = , engine = exponential_tilting) #> #> Response-model (theta) coefficients: -#> (Intercept) : 0.864024 -#> y : -0.170260 +#> (Intercept) : 0.864080 +#> y : -0.170216 ``` Result objects returned by `nmar()` support methods such as `summary()`,