Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add running rust tests #141

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .github/workflows/protobuf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ jobs:
js: true
rust: true
golang: true
- name: Cache `.bin` folder
id: cache-setup
uses: actions/cache@v2
with:
path: .bin
key: ${{ runner.os }}-bin
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems insufficient, as the key won't be invalidated when the dev/proto-generate.sh file changes (as one example).

- run: ./dev/proto-generate.sh
- run: git diff --exit-code
39 changes: 37 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,42 @@ jobs:
- uses: ./.github/actions/asdf
with:
rust: true
- run: cargo check
working-directory: bindings/rust
- name: Cache cargo registry
Copy link
Contributor

Choose a reason for hiding this comment

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

If we move over to the sparse registry protocol, this might not be needed.

uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo target
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- run: cargo check
working-directory: cmd/tests/reprolang
rust-bindings-test:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we directly use https://github.com/Swatinem/rust-cache instead of having this custom code with key-specificity etc here?

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/asdf
with:
rust: true
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo target
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- run: cargo test
working-directory: bindings/rust