-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (112 loc) · 3.42 KB
/
Copy pathcheck_ed.yml
File metadata and controls
123 lines (112 loc) · 3.42 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
name: "Test ed template"
on:
workflow_dispatch:
push:
paths:
- 'templates/ed/**'
- 'tests/ed/**'
- '.github/workflows/check_ed.yml'
pull_request:
paths:
- 'templates/ed/**'
- 'tests/ed/**'
- '.github/workflows/check_ed.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17
with:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- name: Build template
run: nix build ./templates/ed
- name: Test R script
env:
NO_NUSHELL: '1'
run: |
cd templates/ed
nix develop --command bash -c "Rscript ${{ github.workspace }}/tests/ed/test.R"
- name: Test Python script (disabled by default)
env:
NO_NUSHELL: '1'
run: |
cd templates/ed
nix develop --command bash -c "python3 ${{ github.workspace }}/tests/ed/test.py" || echo "SKIP: Python packages not enabled"
test-with-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17
with:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- name: Setup test directory with Python enabled
run: |
TEST_DIR=$(mktemp -d)
cp -r templates/ed/. "$TEST_DIR/"
cd "$TEST_DIR"
sed -i 's/python[[:space:]]*=[[:space:]]*false;/python = true;/' flake.nix
grep -q "python[[:space:]]*=[[:space:]]*true;" flake.nix || {
echo "Error: Failed to enable Python in flake.nix"
exit 1
}
echo "TEST_DIR=$TEST_DIR" >> $GITHUB_ENV
- name: Build with Python enabled
run: |
cd "$TEST_DIR"
nix build
- name: Test Python packages
env:
NO_NUSHELL: '1'
run: |
cd "$TEST_DIR"
nix develop --command bash -c "python3 ${{ github.workspace }}/tests/ed/test.py"
test-with-julia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17
with:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- name: Setup test directory with Julia enabled
run: |
TEST_DIR=$(mktemp -d)
cp -r templates/ed/. "$TEST_DIR/"
cd "$TEST_DIR"
sed -i 's/julia[[:space:]]*=[[:space:]]*false;/julia = true;/' flake.nix
grep -q "julia[[:space:]]*=[[:space:]]*true;" flake.nix || {
echo "Error: Failed to enable Julia in flake.nix"
exit 1
}
echo "TEST_DIR=$TEST_DIR" >> $GITHUB_ENV
- name: Build with Julia enabled
run: |
cd "$TEST_DIR"
nix build
- name: Test Julia packages
env:
NO_NUSHELL: '1'
run: |
cd "$TEST_DIR"
# nix develop --command bash -c "julia ${{ github.workspace }}/tests/ed/test.jl"