-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.5 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
#file: noinspection SpellCheckingInspection
name: CI
on:
push:
workflow_dispatch:
inputs:
power_wash:
type: boolean
description: Fetch versions that are already in the cache
required: true
default: false
jobs:
changes:
name: Check file changes
runs-on: ubuntu-latest
outputs:
cargo: ${{ steps.changes.outputs.cargo }}
silo: ${{ steps.changes.outputs.silo }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
cargo: ['Cargo.*', 'Deny.toml', '**/*/Cargo.*']
silo: ['Cargo.*', 'silo/**/*', 'modules/data/**/*', 'modules/net/**/*', 'modules/utils/**/*']
check:
name: Check code
needs: [ changes ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run cargo-deny
if: needs.changes.outputs.cargo == 'true'
run: |
cargo install cargo-deny
cargo-deny check -c Deny.toml bans licenses sources
- uses: olix0r/cargo-action-fmt/setup@v2
- run: cargo check --locked --message-format=json | cargo-action-fmt
- run: cargo test --locked --no-run --message-format=json | cargo-action-fmt
- run: cargo test --locked
metadata:
name: Deploy metadata site
needs: [ check, changes ]
if: (github.event_name == 'push' && needs.changes.outputs.silo == 'true') || (github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
concurrency: Metadata Site
environment:
name: Metadata Site
url: ${{ steps.deployment.outputs.url }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: git clone --depth 1 https://andre4ik3:${{ secrets.META_TOKEN }}@github.com/andre4ik3/Launcher-Meta.git _site
- name: Run silo
run: |
if [[ "${{ inputs.power_wash }}" == "true" ]]; then
cargo run --locked --bin silo -- --power-wash
else
cargo run --locked --bin silo
fi
- uses: EndBug/add-and-commit@v9
with: { cwd: "./_site", default_author: github_actions }
- id: deployment
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: launchermeta
directory: _site