Skip to content

partial external_js_files #58

partial external_js_files

partial external_js_files #58

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