Skip to content

Commit 6668547

Browse files
authored
Merge pull request #424 from mihem/remove_duplicate_third
Keeping track of fetched packages and commits to avoid duplicates and make fetching remotes faster
2 parents d196550 + b8bb34b commit 6668547

25 files changed

+791
-628
lines changed

.github/workflows/test-dedup.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@ jobs:
3232

3333
- name: Build default.nix that results in duplicates
3434
run: |
35-
nix-shell default.nix --run "Rscript -e \"devtools::load_all();rix(date = '2023-12-30', r_pkgs = c('tidyverse', 'mlr3', 'qs', 'matrixStats', 'prospectr', 'Cubist', 'checkmate', 'mlr3misc', 'paradox'), git_pkgs = list(package_name = 'mlr3extralearners', repo_url = 'https://github.com/mlr-org/mlr3extralearners/', commit = '6e2af9ef9ecd420d2be44e9aa2488772bb9f7080'), ide = 'none', project_path = '.', overwrite = TRUE, print = FALSE)\""
35+
nix-shell default.nix --run "Rscript -e \"devtools::load_all();rix(date = '2023-12-30', r_pkgs = c('tidyverse', 'mlr3', 'qs', 'matrixStats', 'prospectr', 'Cubist', 'checkmate', 'mlr3misc', 'paradox'), git_pkgs = list(package_name = 'mlr3extralearners', repo_url = 'https://github.com/mlr-org/mlr3extralearners/', commit = '6e2af9ef9ecd420d2be44e9aa2488772bb9f7080'), ide = 'none', project_path = '.', overwrite = TRUE, print = FALSE, ignore_remotes_cache = FALSE)\""
3636
3737
- name: Download test default.nix without dups
3838
run: |
39-
wget -O dups-entries_default.nix https://raw.githubusercontent.com/ropensci/rix/refs/heads/main/tests/testthat/_snaps/rix/dups-entries_default.nix
39+
wget -O mlr3_default.nix https://raw.githubusercontent.com/mihem/rix/refs/heads/remove_duplicate_third/tests/testthat/testdata/remote-pkgs/mlr3_default.nix
4040
41-
- name: Remove lines starting with # from generated expression
41+
- name: Remove lines starting with `#` from generated expression
4242
run: sed -i '/^#/d' default.nix
4343

44-
- name: Remove empty last line in dups-entries_default.nix
45-
run: sed -i '${/^$/d;}' dups-entries_default.nix
46-
47-
- name: Compare lines
48-
run: diff -q default.nix dups-entries_default.nix || exit 1
44+
- name: Compare lines and fail if different
45+
run: diff -q default.nix mlr3_default.nix || exit 1

.github/workflows/test-dup.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Integration tests for keeping duplicates
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
8+
name: test-dup
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
devtools:
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Nix
23+
uses: DeterminateSystems/nix-installer-action@main
24+
25+
- uses: cachix/cachix-action@v15
26+
with:
27+
name: rstats-on-nix
28+
# If you chose signing key for write access
29+
# signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
30+
# If you chose API tokens for write access OR if you have a private cache
31+
authToken: '${{ secrets.CACHIX_AUTH }}'
32+
33+
- name: Build default.nix that results in duplicates
34+
run: |
35+
nix-shell default.nix --run "Rscript -e \"devtools::load_all();rix(date = '2023-12-30', r_pkgs = c('tidyverse', 'mlr3', 'qs', 'matrixStats', 'prospectr', 'Cubist', 'checkmate', 'mlr3misc', 'paradox'), git_pkgs = list(package_name = 'mlr3extralearners', repo_url = 'https://github.com/mlr-org/mlr3extralearners/', commit = '6e2af9ef9ecd420d2be44e9aa2488772bb9f7080'), ide = 'none', project_path = '.', overwrite = TRUE, print = FALSE, ignore_remotes_cache = TRUE)\""
36+
37+
- name: Download test default.nix with dups
38+
run: |
39+
wget -O mlr3_dups_default.nix https://raw.githubusercontent.com/mihem/rix/refs/heads/remove_duplicate_third/tests/testthat/testdata/remote-pkgs/mlr3_dups_default.nix
40+
41+
- name: Remove lines starting with `#` from generated expression
42+
run: sed -i '/^#/d' default.nix
43+
44+
- name: Compare lines and fail if different
45+
run: diff -q default.nix mlr3_dups_default.nix || exit 1

0 commit comments

Comments
 (0)