-
Notifications
You must be signed in to change notification settings - Fork 37
119 lines (118 loc) Β· 4.27 KB
/
tests-and-formatting.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
name: Tests and Formatting
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
# Order matters!
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
- '**.rs'
- '**.ftd' # ftd/html/js/css are fbt-tests items mostly
- '**.p1'
- '**.html'
- '**.js'
- '**.css'
- '!t/' # We use this for playground
- '!fastn.com/'
- '!v0.5/' # TODO: remove this when we're ready to release v0.5
- '!.github/'
- '.github/workflows/tests-and-formatting.yml'
pull_request:
branches: [ main ]
paths:
# Order matters!
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
- '**.rs'
- '**.ftd' # ftd/html/js/css are fbt-tests items mostly
- '**.p1'
- '**.html'
- '**.js'
- '**.css'
- '!t/' # We use this for playground
- '!fastn.com/'
- '!v0.5/' # TODO: remove this when we're ready to release v0.5
- '!.github/'
- '.github/workflows/tests-and-formatting.yml'
jobs:
tests-and-formatting:
name: Rust/JS Checks/Formatting
runs-on: ubuntu-latest
env:
FASTN_DB_URL: sqlite:///test.sqlite
DEBUG: true
FASTN_ENABLE_AUTH: true
FASTN_ENABLE_EMAIL: false
steps:
- name: Check out
uses: actions/checkout@v4
# - name: Set up cargo cache
# uses: actions/cache@v3 # there is also https://github.com/Swatinem/rust-cache
# continue-on-error: false
# with:
# path: |
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.os }}-cargo-
- name: Run cargo fmt
id: fmt
run: cargo fmt --all -- --check
continue-on-error: true
- name: Run cargo clippy
id: clippy
continue-on-error: true
run: cargo clippy --all -- -D warnings
# - name: Install cargo check tools
# run: |
# cargo install --locked cargo-deny || true
# cargo install --locked cargo-outdated || true
# cargo install --locked cargo-udeps || true
# cargo install --locked cargo-audit || true
# cargo install --locked cargo-pants || true
# - name: Check
# run: |
# cargo deny check
# cargo outdated --exit-code 1
# cargo udeps
# rm -rf ~/.cargo/advisory-db
# cargo audit
# cargo pants
- name: Run cargo test
# cd fastn-core && fbt -f
# cargo test html_test_all -- --nocapture fix=true
# cargo test fastn_js_test_all -- --nocapture fix=true
# cargo test p1_test_all -- --nocapture fix=true
# cargo test interpreter_test_all -- --nocapture fix=true
# cargo test executor_test_all -- --nocapture fix=true
id: test
continue-on-error: true
run: cargo test
# - name: Run integration tests
# id: integration-test
# continue-on-error: true
# run: |
# bash .github/scripts/run-integration-tests.sh
- name: Check if JS code is properly formatted
# curl -fsSL https://dprint.dev/install.sh | sh
# /Users/amitu/.dprint/bin/dprint fmt --config .github/dprint-ci.json
id: js-fmt
uses: dprint/[email protected]
with:
config-path: .github/dprint-ci.json
- name: Check if code is properly formatted
if: steps.fmt.outcome != 'success'
run: exit 1
- name: Check if clippy is happy
if: steps.clippy.outcome != 'success'
run: exit 1
- name: Check if js-fmt is happy
if: steps.js-fmt.outcome != 'success'
run: exit 1
- name: Check if test succeeded
if: steps.test.outcome != 'success'
run: exit 1
# - name: Check if integration test passed
# if: steps.integration-test.outcome != 'success'
# run: exit 1