Skip to content

Commit

Permalink
Add caching to test CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
epilys committed Mar 21, 2023
1 parent c6c79d8 commit fe4024a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 68 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/spellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- name: Install aspell
run: |
set -ex
sudo apt install aspell aspell-en
- name: Run aspell
shell: bash
run: |
Expand Down
89 changes: 21 additions & 68 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
- 'tests/**'
- 'Cargo.lock'
- 'Cargo.toml'
- '*.md'

jobs:
test:
Expand Down Expand Up @@ -46,10 +45,19 @@ jobs:
# artifact_name: 'gerb-darwin-arm64'
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
- id: cache-rustup
name: Cache Rust toolchain
uses: actions/cache@v3
with:
path: ~/.rustup
key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt
target: ${{ matrix.target }}
override: true
- name: Configure cargo data directory
Expand All @@ -59,19 +67,23 @@ jobs:
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- name: Setup Rust target
if: matrix.target
- id: cache-cargo
name: Cache cargo configuration and installations
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargo-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Setup Rust target
run: |
mkdir -p .cargo
cat << EOF > .cargo/config.toml
[build]
target = "${{ matrix.target }}"
EOF
- name: Add lint dependencies
if: matrix.target
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Add lint dependencies
run: |
rustup component add --target "${{ matrix.target }}" clippy
rustup component add --target "${{ matrix.target }}" rustfmt
cargo install --target "${{ matrix.target }}" cargo-sort
- name: Install dependencies (macos x86_64)
if: matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin'
Expand All @@ -94,70 +106,11 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
set -ex
sudo apt install libgtk-3-dev aspell aspell-en
sudo apt install libgtk-3-dev
- name: Cargo check
run: |
make feature-check
- name: Cargo test
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f>
run: |
cargo test
- name: Spell check markdown files
if: (success() || failure()) && matrix.os == 'ubuntu-latest'
shell: bash
run: |
for m in README.md CONTRIBUTING.md; do
aspell --mode markdown --dont-suggest --personal <(
cat << EOF
personal_ws-1.1 en 0
gerb
gerb's
gtk
proto
indo
href
png
src
px
br
kbd
README
cd
UFOv
thinsp
kbd
Ctrl
kbd
thinsp
ufo
XDG
CONFIG
TOML
PRs
dconf
img
libgtk
dev
macOS
Homebrew
librsvg
Glyphs
OpenType
TrueType
undos
themeable
designspaces
github
cli
svg
github's
FOSS
FontForge
runebender
MFEK
UI
toolkit
toolkit's
EOF
) list < $m
done

0 comments on commit fe4024a

Please sign in to comment.