-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·110 lines (89 loc) · 2.27 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright (C) 2024 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT
name: CI
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- ".github/workflows/ci.yml"
- "R/**"
- "src/**"
- "test/**"
- "conanfile.txt"
- "run_conan.py"
- "DESCRIPTION"
- "NAMESPACE"
tags:
- 'v*.*.*'
pull_request:
paths:
- ".github/workflows/ci.yml"
- "R/**"
- "src/**"
- "test/**"
- "conanfile.txt"
- "run_conan.py"
- "DESCRIPTION"
- "NAMESPACE"
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:
ci:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
r-version: ["3.6.3", "4.3.2"]
runs-on: ${{ matrix.platform }}
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: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Add requirements
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Generate cache key
id: cache-key
run: |
hash="${{ hashFiles('conanfile.txt', '.github/workflows/ci.yml') }}"
echo "conan-key=ci-$hash" >> $GITHUB_OUTPUT
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v3
with:
key: conan-${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Build and test package
uses: r-lib/actions/check-r-package@v2
ci-status-check:
name: Status Check (CI)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- ci
steps:
- name: Collect job results
if: needs.ci.result != 'success'
run: exit 1