Skip to content

Commit

Permalink
feat: further improve ci runtime (#414)
Browse files Browse the repository at this point in the history
* Remove dependency to holochain

* Add rust-cache

* Add cachix nix config

* Add ci job concurrency options

* Update cachix configurations

* Run rust checks/tests outside nix

* add missing components

* Cache rust builds

* Bump holochain deps

* Update rustdocs

* Build cargo deps separately

* refactor flake

* Update maintenance docs

* Add extraPullNames input to cachix actions

* Add nix_build step

* Extend extra-substituters and public-keys in nixConfig

* Fix ci workflow

* Bump client-js version
  • Loading branch information
c12i committed Dec 10, 2024
1 parent 4be8ac5 commit a6e9b69
Show file tree
Hide file tree
Showing 7 changed files with 998 additions and 4,735 deletions.
84 changes: 60 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
name: "test"
name: "scaffolding-ci"

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches: [develop, develop-0.1, develop-0.2, develop-0.4]
branches: [develop, develop-0.4]
pull_request:
branches: [develop, develop-0.1, develop-0.2, develop-0.4]
branches: [develop, develop-0.4]

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

jobs:
test_fmt_lint:
cargo_test:
name: cargo_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
- uses: Swatinem/rust-cache@v2
- run: cargo test --no-fail-fast

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
components: rustfmt
- run: cargo fmt --all -- --check

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings

nix_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -24,31 +62,24 @@ jobs:
remove-docker-images: "true"

- name: Install nix
uses: cachix/install-nix-action@v27
uses: cachix/install-nix-action@v30
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install

- uses: cachix/cachix-action@v15
with:
name: holochain-ci

- name: rustfmt check
run: |
cd $GITHUB_WORKSPACE
nix develop .#ci --command cargo fmt --all --check
- name: clippy check
run: |
cd $GITHUB_WORKSPACE
nix develop .#ci --command cargo clippy --all-features --all-targets -- -D warnings
name: holochain-scaffolding-cli
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extraPullNames: holochain-ci

- name: unittests
- name: Build
run: |
cd $GITHUB_WORKSPACE
nix develop .#ci --command cargo test --no-fail-fast
nix develop --accept-flake-config .#ci --command echo 'test'
testbuild:
runs-on: ubuntu-latest
needs: [nix_build]
strategy:
matrix:
template: [svelte, vue, lit, react, vanilla]
Expand All @@ -65,21 +96,24 @@ jobs:
remove-docker-images: "true"

- name: Install nix
uses: cachix/install-nix-action@v27
uses: cachix/install-nix-action@v30
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install

- uses: cachix/cachix-action@v15
with:
name: holochain-ci
name: holochain-scaffolding-cli
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extraPullNames: holochain-ci

- name: Build and test
run: |
cd $GITHUB_WORKSPACE
nix develop .#ci --command ./run_test.sh -t ${{ matrix.template }}
nix develop --accept-flake-config .#ci --command ./run_test.sh -t ${{ matrix.template }}
testbuild_by_scope:
runs-on: ubuntu-latest
needs: [nix_build]
strategy:
matrix:
scope:
Expand All @@ -98,15 +132,17 @@ jobs:
remove-docker-images: "true"

- name: Install nix
uses: cachix/install-nix-action@v27
uses: cachix/install-nix-action@v30
with:
install_url: https://releases.nixos.org/nix/nix-2.24.4/install

- uses: cachix/cachix-action@v15
with:
name: holochain-ci
name: holochain-scaffolding-cli
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extraPullNames: holochain-ci

- name: Build and test
run: |
cd $GITHUB_WORKSPACE
nix develop .#ci --command ./run_test.sh -s ${{ matrix.scope }}
nix develop --accept-flake-config .#ci --command ./run_test.sh -s ${{ matrix.scope }}
Loading

0 comments on commit a6e9b69

Please sign in to comment.