Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Fix #178: Make MNT{4,6}-753, cp6_782 tests run conditionally #179

Merged
merged 27 commits into from
Sep 25, 2023
Merged
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 87 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
- dir: curve-constraint-tests/
- dir: mnt4_753/
- dir: mnt6_753/
- dir: cp6_782/
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -115,27 +116,109 @@ jobs:
test-mnt4-753:
name: Test (mnt4_753/)
runs-on: macos-latest
needs: [directories] # Waits for the directory listing job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests

- name: Check if source code updated
uses: dorny/[email protected]
id: check-diff
with:
filters: |
mnt4_753_is_updated:
- 'mnt4_753/**'

- name: Generate lockfile
run: cargo generate-lockfile

- name: Check if deps updated
id: deps-updated
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: mnt4_753-deps-updated-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can avoid the mnt4_753-deps-updated- prefix, as the Cargo.lock file is shared across the entire workspace. So we'd be unnecessarily creating an additional cache entry and possibly causing false cache misses if we use this key. Ditto for the other curves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That last change didn't result in "cache hits" like I expected...

Does cargo generate-lockfile need to be added before the cache invocation at line 53?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second run seems to work as expected. I'll wait for you to let me know when to merge.


- name: Conditionally run the tests
# if source code updated OR dependencies updated
if: ${{ steps.check-diff.outputs.mnt4_753_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
run: |
cd mnt4_753/
cargo test --all-features

test-mnt6-753:
name: Test (mnt6_753/)
runs-on: macos-latest
needs: [directories] # Waits for the directory listing job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests

- name: Check if source code updated
uses: dorny/[email protected]
id: check-diff
with:
filters: |
mnt6_753_is_updated:
- 'mnt6_753/**'

- name: Generate lockfile
run: cargo generate-lockfile

- name: Check if deps updated
id: deps-updated
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: mnt6_753-deps-updated-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Conditionally run the tests
# if source code updated OR dependencies updated
if: ${{ steps.check-diff.outputs.mnt6_753_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
run: |
cd mnt6_753/
cargo test --all-features

test-cp6_782:
name: Test (cp6_782/)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Check if source code updated
uses: dorny/[email protected]
id: check-diff
with:
filters: |
cp6_782_is_updated:
- 'cp6_782/**'

- name: Generate lockfile
run: cargo generate-lockfile

- name: Check if deps updated
id: deps-updated
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cp6_782-deps-updated-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Conditionally run the tests
# if source code updated OR dependencies updated
if: ${{ steps.check-diff.outputs.cp6_782_is_updated == 'true' || steps.deps-updated.outputs.cache-hit != 'true' }}
run: |
cd cp6_782/
cargo test --all-features


docs:
name: Check Documentation
runs-on: ubuntu-latest
Expand Down
Loading