Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Odonno committed Sep 3, 2024
1 parent d4f8626 commit eae2ecb
Showing 1 changed file with 30 additions and 87 deletions.
117 changes: 30 additions & 87 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,26 @@ name: Main Workflow

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install 1.80.0 toolchain
uses: dtolnay/rust-toolchain@1.80.0
with:
components: clippy, rustfmt

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Download SurrealDB
run: curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --beta

- name: Run SurrealDB root
run: surreal start --user root --pass root memory &

- name: Run SurrealDB admin
run: surreal start --user admin --pass admin --bind 0.0.0.0:8001 memory &

- name: Run check
run: cargo check --all

- name: Run tests
run: cargo test

- name: Run format
run: |
cargo check --all
cargo fix
- name: Run lint
run: cargo clippy -- -Dwarnings

coverage:
needs: ci
if: github.ref == 'refs/heads/main'
release-binary:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: x86_64-apple-darwin
archive: zip
- target: wasm32-wasi
archive: zip

steps:
- name: Checkout repository
Expand All @@ -63,32 +33,18 @@ jobs:
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Download SurrealDB
run: curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --beta

- name: Run SurrealDB root
run: surreal start --user root --pass root memory &

- name: Run SurrealDB admin
run: surreal start --user admin --pass admin --bind 0.0.0.0:8001 memory &

- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: "0.22.0"
args: "--engine llvm --target-dir target/tarpaulin --skip-clean"

- name: Upload to codecov.io
uses: codecov/codecov-action@v3

- name: Archive code coverage results
uses: actions/upload-artifact@v1
- name: Compile and release
uses: rust-build/rust-build.action@v1.4.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: code-coverage-report
path: cobertura.xml
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
EXTRA_FILES: "readme.md LICENSE"
TOOLCHAIN_VERSION: stable

docs:
runs-on: ubuntu-latest
release-exe:
runs-on: windows-latest

steps:
- name: Checkout repository
Expand All @@ -100,24 +56,11 @@ jobs:
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Build documentation
run: cargo doc

cargo-deny:
name: cargo-deny
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources

# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}

steps:
- uses: actions/checkout@v3
- name: Build release
run: cargo build --release

- uses: EmbarkStudios/cargo-deny-action@v1
- name: Publish release
uses: softprops/action-gh-release@v2
with:
command: check ${{ matrix.checks }}
files: target/release/surrealdb-migrations.exe
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit eae2ecb

Please sign in to comment.