File tree Expand file tree Collapse file tree 6 files changed +73
-16
lines changed Expand file tree Collapse file tree 6 files changed +73
-16
lines changed Original file line number Diff line number Diff line change 1+ name : Setup Apt and Install Packages
2+ description : Configures apt, runs update once per job, and installs packages.
3+
4+ inputs :
5+ packages :
6+ description : A space-separated list of packages to install.
7+ required : true
8+
9+ runs :
10+ using : composite
11+ steps :
12+ - name : Configure dpkg and apt for CI
13+ shell : bash
14+ run : |
15+ # Avoid time-consuming man-db updates.
16+ sudo tee /etc/dpkg/dpkg.cfg.d/99-no-doc > /dev/null <<EOF
17+ path-exclude /usr/share/doc/*
18+ path-exclude /usr/share/man/*
19+ path-exclude /usr/share/info/*
20+ EOF
21+
22+ # Exclude translations.
23+ sudo tee /etc/apt/apt.conf.d/99-no-translations > /dev/null <<EOF
24+ Acquire::Languages "none";
25+ EOF
26+
27+ # Exclude command-not-found utility.
28+ sudo rm -f /etc/apt/apt.conf.d/50command-not-found
29+
30+ # Remove unnecessary repository lists (we don't install Azure
31+ # utilities)
32+ sudo rm -f /etc/apt/sources.list.d/microsoft-prod.* /etc/apt/sources.list.d/azure-cli.*
33+
34+ - name : Run apt-get update
35+ if : env.APT_UPDATED != 'true'
36+ shell : bash
37+ run : |
38+ sudo apt-get update
39+ echo "APT_UPDATED=true" >> $GITHUB_ENV
40+
41+ - name : Installing ${{ inputs.packages }}
42+ shell : bash
43+ run : |
44+ sudo apt-get install --quiet --yes ${{ inputs.packages }}
Original file line number Diff line number Diff line change 6262 uses : ./.github/workflows/setup-rust-cache
6363
6464 - name : Install dependencies
65- run : |
66- sudo apt update
67- sudo apt install gcc-aarch64-linux-gnu
65+ uses : ./.github/workflows/apt-get-install
66+ with :
67+ packages : gcc-aarch64-linux-gnu
6868
6969 - name : Build Rust code
7070 working-directory : ${{ matrix.directory }}
@@ -113,10 +113,10 @@ jobs:
113113 with :
114114 key : ${{ contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language) }}
115115
116- - name : Install Gettext
117- run : |
118- sudo apt update
119- sudo apt install gettext
116+ - name : Install dependencies
117+ uses : ./.github/workflows/apt-get-install
118+ with :
119+ packages : gettext
120120
121121 - name : Install mdbook
122122 uses : ./.github/workflows/install-mdbook
Original file line number Diff line number Diff line change @@ -12,10 +12,13 @@ runs:
1212 run : cargo xtask install-tools --binstall
1313 shell : bash
1414
15- - name : Install dependencies for mdbook-pandoc
15+ - name : Install mdbook-pandoc dependencies
16+ uses : ./.github/workflows/apt-get-install
17+ with :
18+ packages : texlive texlive-luatex texlive-lang-cjk texlive-lang-arabic librsvg2-bin fonts-noto
19+
20+ - name : Install mdbook-pandoc
1621 run : |
17- sudo apt-get update
18- sudo apt-get install -y texlive texlive-luatex texlive-lang-cjk texlive-lang-arabic librsvg2-bin fonts-noto
1922 curl -LsSf https://github.com/jgm/pandoc/releases/download/3.7.0.1/pandoc-3.7.0.1-linux-amd64.tar.gz | tar zxf -
2023 echo "$PWD/pandoc-3.7.0.1/bin" >> $GITHUB_PATH
2124 shell : bash
Original file line number Diff line number Diff line change 3131 uses : actions/checkout@v5
3232
3333 - name : Install formatting dependencies
34- run : |
35- sudo apt update
36- sudo apt install gettext yapf3
34+ uses : ./.github/workflows/apt-get-install
35+ with :
36+ packages : gettext yapf3
3737
3838 - name : Install pinned nightly for rustfmt
3939 run : |
Original file line number Diff line number Diff line change 4242 uses : ./.github/workflows/setup-rust-cache
4343
4444 - name : Install Gettext
45- run : |
46- sudo apt update
47- sudo apt install gettext
45+ uses : ./.github/workflows/apt-get-install
46+ with :
47+ packages : gettext
4848
4949 - name : Install mdbook
5050 uses : ./.github/workflows/install-mdbook
Original file line number Diff line number Diff line change @@ -80,6 +80,16 @@ list of options.
8080- ** Contributions:** Refer to ` CONTRIBUTING.md ` for guidelines on contributing
8181 to the project.
8282- ** Style:** Refer to ` STYLE.md ` for style guidelines.
83+ - ** GitHub Actions:** The project uses composite GitHub Actions to simplify CI
84+ workflows. These actions should be preferred over hand-written commands.
85+ - ** ` apt-get-install ` :** This action efficiently installs Debian packages. It
86+ configures ` dpkg ` and ` apt ` to skip documentation and translations, and
87+ ensures that ` apt-get update ` is run only once per job. This significantly
88+ speeds up CI runs.
89+ - ** ` install-mdbook ` :** A composite action to install ` mdbook ` and its
90+ dependencies, including ` pandoc ` and ` texlive ` .
91+ - ** ` setup-rust-cache ` :** A composite action that configures the
92+ ` Swatinem/rust-cache ` action.
8393
8494## Markdown Conventions
8595
You can’t perform that action at this time.
0 commit comments