Skip to content

Commit

Permalink
Merge pull request #3 from EspressoSystems/set_up_ci
Browse files Browse the repository at this point in the history
flake and workflows
  • Loading branch information
nyospe authored Feb 16, 2024
2 parents d7a051a + 66ab9eb commit ec8e546
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"

69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build

on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
env:
RUST_LOG: info

steps:
- uses: actions/checkout@v4
name: Checkout Repository

- name: Install Protoc
uses: arduino/setup-protoc@v2

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching

- name: Format Check
run: cargo fmt -- --check

- name: Audit
run: cargo audit --ignore RUSTSEC-2023-0018 --ignore RUSTSEC-2023-0052 --ignore RUSTSEC-2023-0065

- name: Lint
run: |
cargo clippy --workspace --release
- name: Build
# Build in release without `testing` feature.
run: |
cargo build --workspace --release
- name: Test
# Build test binary with `testing` feature
run: |
cargo test --workspace --release --all-features --no-run
cargo test --workspace --release --all-features --verbose -- --test-threads 2
timeout-minutes: 60

- name: Generate Documentation
run: |
cargo doc --no-deps --lib --release
echo '<meta http-equiv="refresh" content="0; url=versioned-binary-serialization">' > target/doc/index.html
- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
cname: versioned-binary-serialization.docs.espressosys.com
46 changes: 46 additions & 0 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Nix

on:
push:
branches:
- main
- release-*
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
nix:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v24

# - uses: cachix/cachix-action@v12
# with:
# name: espresso-systems-private
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Cache cargo
uses: actions/[email protected]
with:
path: |
~/.cargo-nix/registry/index
~/.cargo-nix/registry/cache
~/.cargo-nix/git
target
key: espresso-nix-v2-${{ hashFiles('Cargo.lock') }}

- name: "Sanity Check: nix environment loads"
run: nix-shell --run "echo Success"

- name: "Sanity Check: nix environment builds all targets"
run: nix-shell --run "cargo build --all-targets --all-features --release --workspace"
55 changes: 55 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2022 Espresso Systems (espressosys.com)
# This file is part of the Tide Disco library.
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not,
# see <https://www.gnu.org/licenses/>.

name: Windows build

on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
windows:
runs-on: windows-latest
env:
RUST_LOG: info
steps:
- uses: dtolnay/rust-toolchain@stable

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Checkout Repository
uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching

- name: Build
run: |
cargo build --workspace --release
- name: Test
run: |
cargo test --workspace --release --all-features --no-run
cargo test --workspace --release --all-features --verbose -- --test-threads 2
timeout-minutes: 60
33 changes: 33 additions & 0 deletions .github/workflows/debug_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Debug Build

on:
schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
env:
RUST_LOG: info
steps:
- uses: dtolnay/rust-toolchain@stable

- uses: actions/checkout@v4
name: Checkout Repository

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching

- name: Build
run: |
cargo build --workspace --all-features
- name: Test
run: |
cargo test --workspace --all-features --no-run
cargo test --workspace --all-features --verbose -- --test-threads 2
timeout-minutes: 60
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
# Lint with many combinations of feature flags
features:
# No optional features
- ''
env:
RUST_LOG: info
steps:
- uses: actions/checkout@v4
name: Checkout Repository

- name: Install Protoc
uses: arduino/setup-protoc@v2

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching

- uses: actions-rs/clippy-check@v1
name: Clippy
with:
token: ${{ github.token }}
args: --workspace --no-default-features --features "${{ matrix.features }}" -- -D warnings
26 changes: 26 additions & 0 deletions .github/workflows/update_nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: update-flake-lock

on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v24

- uses: cachix/cachix-action@v13
with:
name: espresso-systems-private
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v20
with:
pr-title: "Weekly PR to bump flake.nix" # Title of PR to be created
Loading

0 comments on commit ec8e546

Please sign in to comment.