diff --git a/.github/workflows/r-build.yml b/.github/workflows/r-build.yml new file mode 100755 index 0000000..bc3a13d --- /dev/null +++ b/.github/workflows/r-build.yml @@ -0,0 +1,99 @@ +# Copyright (C) 2024 Roberto Rossini (roberros@uio.no) +# SPDX-License-Identifier: MIT + +name: R CMD build + +on: + workflow_dispatch: + push: + branches: [ main ] + paths: + - ".github/workflows/r-build.yml" + - "R/**" + - "src/**" + - "tests/**" + - "conanfile.txt" + - "run_conan.py" + - "DESCRIPTION" + - "NAMESPACE" + tags: + - 'v*.*.*' + + pull_request: + paths: + - ".github/workflows/r-build.yml" + - "R/**" + - "src/**" + - "tests/**" + - "conanfile.txt" + - "run_conan.py" + - "DESCRIPTION" + - "NAMESPACE" + + release: + types: + - published + +env: + CONAN_HOME: "${{ github.workspace }}/conan/" + +# https://stackoverflow.com/a/72408109 +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + r-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Generate requirements.txt + run: | + echo 'conan>=2' > requirements.txt + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + cache: 'pip' + + - name: Install Conan + run: pip install -r requirements.txt + + - name: Install pandoc + uses: r-lib/actions/setup-pandoc@v2 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + r-version: 'release' + + - name: Build package + run: R CMD build . + + - uses: actions/upload-artifact@v4 + with: + name: package + path: hictk_*.tar.gz + if-no-files-found: 'error' + retention-days: 7 + compression-level: 0 + + + ci-status-check: + name: Status Check (R CMD build) + if: ${{ always() }} + runs-on: ubuntu-latest + needs: + - r-build + + steps: + - name: Collect job results + if: needs.r-build.result != 'success' + run: exit 1