fix: compilation flags #247
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: External Use | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| workflow_dispatch: null | |
| permissions: read-all | |
| jobs: | |
| cascade-test: | |
| name: cascade-${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| - windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| with: | |
| persist-credentials: false | |
| - name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@97330871fe1b7d3529392ea000e3d2c4b357e403 | |
| id: cpu-cores | |
| - uses: r-lib/actions/setup-r@d3c5be51b12e724e68f33216ca3c148b66d5f0b6 | |
| with: | |
| update-rtools: true | |
| Ncpus: ${{ steps.cpu-cores.outputs.count }} | |
| - name: Install dependencies (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y --no-install-recommends \ | |
| libarchive-dev libcurl4-openssl-dev libfribidi-dev libharfbuzz-dev \ | |
| libnetcdf-dev libuv1-dev \ | |
| && sudo apt-get clean \ | |
| && sudo rm -rf /var/lib/apt/lists/* | |
| mkdir -p ~/.R | |
| cat >> ~/.R/Makevars <<EOF | |
| CFLAGS += -march=native -mtune=native -g -O3 -flto=auto -fopenmp -ffp-contract=fast -DNDEBUG | |
| CXXFLAGS += -march=native -mtune=native -g -O3 -flto=auto -fopenmp -ffp-contract=fast -DNDEBUG | |
| LDFLAGS += -flto=auto -fopenmp | |
| EOF | |
| - name: Install dependencies (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew update | |
| brew install netcdf libomp | |
| LIBOMP_PREFIX="$(brew --prefix libomp)" | |
| NETCDF_PREFIX = $(brew --prefix netcdf) | |
| OPENSSL_PREFIX="$(brew --prefix openssl@3)" | |
| mkdir -p ~/.R | |
| # Detect architecture for correct optimization flags | |
| if [[ $(uname -m) == "arm64" ]]; then | |
| ARCH_FLAGS="-mcpu=native" | |
| else | |
| ARCH_FLAGS="-march=native -mtune=native" | |
| fi | |
| cat >> ~/.R/Makevars <<EOF | |
| CPPFLAGS += -I${LIBOMP_PREFIX}/include | |
| CFLAGS += ${ARCH_FLAGS} -g -O3 -flto=thin -ffp-contract=fast -DNDEBUG -Xpreprocessor -fopenmp | |
| CXXFLAGS += ${ARCH_FLAGS} -g -O3 -flto=thin -ffp-contract=fast -DNDEBUG -Xpreprocessor -fopenmp | |
| LDFLAGS += -flto=thin -L${LIBOMP_PREFIX}/lib -lomp | |
| NCDF_LDFLAGS += -L${NETCDF_PREFIX}/lib | |
| NCDF_CPPFLAGS += -I${NETCDF_PREFIX}/include | |
| OPENSSL_CPPFLAGS += -I${OPENSSL_PREFIX}/include | |
| OPENSSL_LDFLAGS += -L${OPENSSL_PREFIX}/lib | |
| EOF | |
| - name: Install dependencies (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| mkdir -p ~/.R | |
| cat >> ~/.R/Makevars.win <<EOF | |
| CFLAGS += -march=native -mtune=native -g -O3 -flto -fopenmp -DNDEBUG | |
| CXXFLAGS += -march=native -mtune=native -g -O3 -flto -fopenmp -DNDEBUG | |
| LDFLAGS += -flto -fopenmp | |
| EOF | |
| - name: Install | |
| run: > | |
| install.packages( | |
| "cascade", | |
| repos = c( | |
| "https://adafede.r-universe.dev", | |
| "https://taxonomicallyinformedannotation.r-universe.dev", | |
| "https://cran.r-universe.dev", | |
| "https://bioc.r-universe.dev" | |
| ) | |
| ) | |
| shell: Rscript {0} | |
| - name: Run pipeline | |
| run: | | |
| cascade::check_chromatograms_alignment(show_example = TRUE) | |
| cascade::check_peaks_integration(show_example = TRUE) | |
| cascade::process_compare_peaks(show_example = TRUE) | |
| cascade::generate_pseudochromatograms(show_example = TRUE) | |
| cascade::generate_tables(show_example = TRUE) | |
| cascade::generate_ids() | |
| shell: Rscript {0} |