forked from Michael-F-Bryan/mdbook-epub
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (68 loc) · 2.99 KB
/
rust.yml
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
name: Rust
on:
push:
pull_request:
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
include:
- os: ubuntu-latest
install-epubcheck: sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y epubcheck
epubcheck-path: epubcheck
- os: windows-latest
install-epubcheck: |
# Print Windows version and env
cmd.exe /c "ver"
cmd.exe /c "echo Current workspace: %GITHUB_WORKSPACE%"
cmd.exe /c "echo Current directory: %CD%"
cmd.exe /c "mkdir %GITHUB_WORKSPACE%\epubcheck"
cmd.exe /c "echo Created directory at: %GITHUB_WORKSPACE%\epubcheck"
# Donwloading and unpack
curl -L -o %GITHUB_WORKSPACE%\epubcheck\epubcheck.zip https://github.com/w3c/epubcheck/releases/download/v5.2.0/epubcheck-5.2.0.zip
cd %GITHUB_WORKSPACE%\epubcheck
cmd.exe /c "echo Changed to directory: %CD%"
7z x epubcheck.zip
# Current dir content
cmd.exe /c "echo Contents of epubcheck directory:"
cmd.exe /c "dir /s"
echo "EPUBCHECK_PATH=%GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar" >> $GITHUB_ENV
cmd.exe /c "echo Set EPUBCHECK_PATH to: %GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar"
# Setup full path to jar file
echo "EPUBCHECK_PATH=%GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar" >> $GITHUB_ENV
cmd.exe /c "echo Set EPUBCHECK_PATH to: %GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar"
# Check if file exists
cmd.exe /c "if exist %GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar (echo JAR file found at: %GITHUB_WORKSPACE%\epubcheck\epubcheck-5.2.0\epubcheck.jar)"
epubcheck-path: "${{ env.EPUBCHECK_PATH }}"
- os: macos-latest
install-epubcheck: brew install epubcheck
epubcheck-path: epubcheck
runs-on: ${{ matrix.os }}
env:
EPUBCHECK_PATH: ${{ matrix.epubcheck-path }}
steps:
- name: Set up Rust
uses: actions/checkout@v4
- name: Install cargo version
uses: dtolnay/rust-toolchain@stable
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install epubcheck
run: ${{ matrix.install-epubcheck }}
shell: bash
- name: Install cargo audit
run: cargo install cargo-audit
- name: Show rust version
run: cargo --version
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run Clippy
run: cargo clippy -- --no-deps -Dwarnings
- name: Audit
run: cargo audit