Skip to content

Commit 0b17b78

Browse files
committed
deduplicate with composite actions
1 parent d5cb85d commit 0b17b78

File tree

5 files changed

+43
-41
lines changed

5 files changed

+43
-41
lines changed

.github/workflows/analyze.yaml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,9 @@ jobs:
1616
contents: write
1717
steps:
1818
- uses: actions/checkout@v4
19-
- uses: actions/setup-python@v5
20-
with:
21-
python-version: "3.12"
22-
- uses: astral-sh/setup-uv@v3
23-
- run: uv sync
24-
- uses: quarto-dev/quarto-actions/setup@v2
25-
- name: install quarto extensions
26-
working-directory: ./website/skirolly/
27-
run: quarto add --no-prompt https://github.com/qmd-lab/closeread/archive/e3645070dd668004056ae508d2d25d05baca5ad1.zip
28-
- name: Install R
29-
uses: r-lib/actions/setup-r@v2
30-
with:
31-
r-version: '4.4.0'
32-
- name: Install Magick++
33-
run: sudo apt-get install -y libmagick++-dev
34-
- name: Install Poppler C++ API
35-
run: sudo apt-get -y install libpoppler-cpp-dev
36-
- name: Install R Dependencies
37-
uses: r-lib/actions/setup-renv@v2
38-
with:
39-
working-directory: website/skirolly/
19+
- uses: ./.github/workflows/setup-python
20+
- uses: ./.github/workflows/setup-r
21+
- uses: ./.github/workflows/setup-quarto
4022
- name: install fonts
4123
run: sudo apt-get install --yes --quiet fonts-dejavu-core fonts-noto-cjk
4224
# GitHub will remove any cache entries that have not been accessed in over 7 days
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Setup Python
2+
description: Common steps for installing python and project dependencies
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/setup-python@v5
7+
with:
8+
python-version: "3.12"
9+
- uses: astral-sh/setup-uv@v3
10+
- run: uv sync --extra=dev
11+
shell: bash
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Setup Quarto
2+
description: Common steps for installing quarto
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: quarto-dev/quarto-actions/setup@v2
7+
- name: install quarto extensions
8+
working-directory: ./website/skirolly/
9+
run: quarto add --no-prompt https://github.com/qmd-lab/closeread/archive/e3645070dd668004056ae508d2d25d05baca5ad1.zip

.github/workflows/setup-r/action.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup R
2+
description: Common steps for installing R and project dependencies
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Install system packages for R
7+
run: sudo apt-get install --yes --quiet libmagick++-dev libpoppler-cpp-dev
8+
- name: Install R
9+
uses: r-lib/actions/setup-r@v2
10+
with:
11+
r-version: '4.4.0'
12+
- name: Install R Dependencies
13+
uses: r-lib/actions/setup-renv@v2
14+
with:
15+
working-directory: website/skirolly/

.github/workflows/tests.yaml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,15 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10-
- uses: actions/setup-python@v5
11-
with:
12-
python-version: "3.12"
10+
- uses: ./.github/workflows/setup-python
1311
- uses: pre-commit/action@v3.0.1
14-
- uses: astral-sh/setup-uv@v3
15-
- run: uv sync --extra=dev
16-
shell: bash
17-
- run: uv run pytest --color=yes
12+
- name: Python tests
13+
run: uv run pytest --color=yes
1814
r-tests:
1915
runs-on: ubuntu-latest
2016
steps:
2117
- uses: actions/checkout@v4
22-
- name: Install R
23-
uses: r-lib/actions/setup-r@v2
24-
with:
25-
r-version: '4.4.0'
26-
- name: Install Magick++
27-
run: sudo apt-get install -y libmagick++-dev
28-
- name: Install Poppler C++ API
29-
run: sudo apt-get -y install libpoppler-cpp-dev
30-
- name: Install R Dependencies
31-
uses: r-lib/actions/setup-renv@v2
32-
with:
33-
working-directory: website/skirolly/
34-
- name: Test R
18+
- uses: ./.github/workflows/setup-r
19+
- name: R tests
3520
run: Rscript -e "packageVersion('arrow')"
3621
working-directory: website/skirolly/

0 commit comments

Comments
 (0)