|
1 | | -name: "test" |
| 1 | +name: CI |
| 2 | + |
2 | 3 | on: |
3 | | - # Trigger the workflow on push or pull request, |
4 | | - # but only for the main branch |
5 | | - push: |
6 | | - branches: [ main, develop ] |
7 | 4 | pull_request: |
8 | | - branches: [ main, develop ] |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "develop" |
| 8 | + - "main" |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.ref_name }} |
| 12 | + cancel-in-progress: true |
9 | 13 |
|
10 | 14 | jobs: |
11 | | - testbuild: |
12 | | - runs-on: ubuntu-latest |
| 15 | + build-and-test: |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest] |
| 20 | + fail-fast: false |
| 21 | + |
13 | 22 | steps: |
14 | | - - uses: actions/checkout@v2 |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v3 |
15 | 25 |
|
16 | 26 | - name: Install nix |
17 | | - uses: cachix/install-nix-action@v18 |
18 | | - with: |
19 | | - install_url: https://releases.nixos.org/nix/nix-2.12.0/install |
20 | | - extra_nix_config: | |
21 | | - experimental-features = flakes nix-command |
| 27 | + uses: cachix/install-nix-action@v22 |
22 | 28 |
|
23 | | - - uses: cachix/cachix-action@v10 |
| 29 | + - name: Set up cachix |
| 30 | + uses: cachix/cachix-action@v12 |
24 | 31 | with: |
25 | 32 | name: holochain-ci |
26 | 33 |
|
27 | | - - name: Install and test |
28 | | - run: | |
29 | | - nix develop --command bash -c "npm i && npm t" |
| 34 | + - name: Restore cargo and build from cache |
| 35 | + uses: actions/cache/restore@v3 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + .cargo |
| 39 | + target |
| 40 | + key: ${{ runner.os }}-build-${{ hashFiles('Cargo.lock') }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-build- |
| 43 | +
|
| 44 | + - name: Install nix packages |
| 45 | + run: nix develop -c $SHELL -c "echo Nix packages installed" |
| 46 | + |
| 47 | + - name: Install JS packages |
| 48 | + run: nix develop -c $SHELL -c "npm ci" |
| 49 | + |
| 50 | + - name: Clippy |
| 51 | + run: nix develop -c $SHELL -c "cargo clippy" |
| 52 | + |
| 53 | + - name: Check rust formatting |
| 54 | + run: nix develop -c $SHELL -c "cargo fmt" |
| 55 | + |
| 56 | + - name: Build Happ |
| 57 | + run: nix develop -c $SHELL -c "npm run build:happ" |
| 58 | + |
| 59 | + - name: Save cargo and build to cache |
| 60 | + uses: actions/cache/save@v3 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + .cargo |
| 64 | + target |
| 65 | + key: ${{ runner.os }}-build-${{ hashFiles('Cargo.lock') }} |
30 | 66 |
|
| 67 | + - name: Test with tryorama |
| 68 | + run: nix develop -c $SHELL -c "npm test" |
0 commit comments