-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (115 loc) · 3.76 KB
/
ci.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Run Clippy and Format
run: |
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features
- name: Install Cargo LLVM Cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Test with Coverage
run: cargo +nightly llvm-cov --cobertura --output-path cobertura.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.CODECOV_TOKEN }}
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: armv7-unknown-linux-musleabi
os: ubuntu-latest
cross: true
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-pc-windows-msvc
os: windows-latest
cross: false
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Run Cross
if: ${{ matrix.cross }}
run: |
cargo install cross
cross build --release --target ${{ matrix.target }}
- name: Run Cargo
if: ${{ !matrix.cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Create Binary Artifacts
shell: bash
run: |
mkdir artifacts
if [ -f target/${{ matrix.target }}/release/typst-upgrade.exe ]; then
cp target/${{ matrix.target }}/release/typst-upgrade.exe typst-upgrade-${{ matrix.target }}.exe
else
cp target/${{ matrix.target }}/release/typst-upgrade typst-upgrade-${{ matrix.target }}
fi
- name: Upload Binary Artifacts
uses: actions/upload-artifact@v4
with:
name: typst-upgrade-${{ matrix.target }}
path: typst-upgrade-${{ matrix.target }}*
pre-release:
runs-on: ubuntu-latest
needs: [build, test]
if: success() && startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Publish Crate (Dry Run)
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --dry-run
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display Artifact
run: ls -R artifacts
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "artifacts/*/*"
prerelease: true
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true