forked from dylan-sutton-chavez/edge-python
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (96 loc) · 2.98 KB
/
cli.yml
File metadata and controls
119 lines (96 loc) · 2.98 KB
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
name: CLI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
build_test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
# `cli/` is a separate workspace; key the cache off its Cargo.lock and target dir.
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: cli -> cli/target
# Engine tests drive a real Chromium; cache the headless_chrome fetcher dir between runs.
- name: Cache Chromium
uses: actions/cache@v4
with:
path: ~/.local/share/headless-chrome
key: chromium-${{ runner.os }}-headless_chrome-1.0.21
- name: Build
working-directory: cli
run: cargo build
- name: Test
working-directory: cli
run: cargo test
# One native build per target; GitHub's free ARM runners avoid the cross-compile pain.
build_release:
name: Build release (${{ matrix.target }})
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build_test
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
- target: aarch64-unknown-linux-musl
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: cli -> cli/target
key: ${{ matrix.target }}
- name: Build release
working-directory: cli
run: cargo build --release --target ${{ matrix.target }}
- name: Tar
working-directory: cli
run: tar -C target/${{ matrix.target }}/release -czf edge-${{ matrix.target }}.tar.gz edge
- uses: actions/upload-artifact@v4
with:
name: edge-${{ matrix.target }}
path: cli/edge-${{ matrix.target }}.tar.gz
pages:
name: Publish to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build_release
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- name: Collect tarballs and stage Pages site
run: |
mkdir -p _site
cp cli/install.sh _site/install.sh
- uses: actions/download-artifact@v4
with:
path: _site
pattern: edge-*
merge-multiple: true
- uses: actions/upload-pages-artifact@v3
with:
path: _site
- id: deploy
uses: actions/deploy-pages@v4