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

Reduce CI time #318

Open
wants to merge 5 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 15 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
uses: actions/checkout@v3
with:
path: didkit
submodules: true

- name: Checkout SSI library
uses: actions/checkout@v3
Expand All @@ -34,16 +35,7 @@ jobs:
ref: ${{env.SSI_REF}}
submodules: true

- name: Cache Cargo registry and build artifacts
uses: actions/cache@v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', 'lib/Makefile', '**.rs') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: Swatinem/rust-cache@v2

- name: Install Rust old stable with incremental compilation
uses: actions-rs/toolchain@v1
Expand All @@ -53,10 +45,10 @@ jobs:
default: true

- name: Build
run: cargo build --verbose
run: cargo build

- name: Test
run: cargo test --verbose
run: cargo test

- name: Test CLI
run: cli/tests/example.sh
Expand Down Expand Up @@ -110,44 +102,34 @@ jobs:
- name: Test binary-signing verify example
run: examples/binary-signing/index.sh verify examples/binary-signing/hello.txt examples/binary-signing/hello-vc.jsonld

- name: Checkout VC API Test Suite
uses: actions/checkout@v3
with:
repository: w3c-ccg/vc-api-test-suite
path: didkit/http/tests/vc-api/vc-api-test-suite
ref: 4923f0d627a223cd20a4ceb112336477ded445ca

- name: Run VC API Test Suite
working-directory: didkit/http/tests/vc-api
run: |
npm install
npm test

- name: Test C FFI
run: make -C lib ../target/test/c.stamp

- name: Install wasm-pack
run: make -C lib install-wasm-pack
- name: Compile WASM package
working-directory: didkit/lib/web
run: wasm-pack build --dev

- name: Use system JDK
run: echo "$JAVA_HOME/bin" >> $GITHUB_PATH
- name: Test JNI
run: make -C lib ../target/test/java.stamp

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'dev'

- name: Opt out of Dart/Flutter analytics
run: |
dart --disable-analytics
flutter --suppress-analytics config --no-analytics

- name: Test C FFI
run: make -C lib ../target/test/c.stamp

- name: Test WASM package
run: make -C lib ../target/test/wasm.stamp

- name: Test JNI
run: make -C lib ../target/test/java.stamp

- name: Test Dart/Flutter plugin
run: make -C lib ../target/test/flutter.stamp

Expand Down Expand Up @@ -180,16 +162,7 @@ jobs:
ref: ${{env.SSI_REF}}
submodules: true

- name: Cache Cargo registry and build artifacts
uses: actions/cache@v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', 'lib/Makefile', '**.rs') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: Swatinem/rust-cache@v2

- name: Install Rust iOS targets
run: make -C lib install-rustup-ios
Expand All @@ -213,16 +186,7 @@ jobs:
ref: ${{env.SSI_REF}}
submodules: true

- name: Cache Cargo registry and build artifacts
uses: actions/cache@v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', 'lib/Makefile', '**.rs') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --verbose
run: cargo build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "http/tests/vc-api/vc-api-test-suite"]
path = http/tests/vc-api/vc-api-test-suite
url = https://github.com/clehner/vc-api-test-suite
1 change: 0 additions & 1 deletion http/tests/vc-api/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
vc-api-test-suite
node_modules
8 changes: 1 addition & 7 deletions http/tests/vc-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ Requirements: [git][], [Cargo][] and [Node.js][].

`didkit` and `ssi` should be checked out:
```sh
git clone https://github.com/spruceid/didkit
git clone https://github.com/spruceid/didkit --recurse-submodules
git clone https://github.com/spruceid/ssi --recurse-submodules
```

Checkout the `vc-api` test server:
```sh
cd didkit/http/tests/vc-api
git clone https://github.com/w3c-ccg/vc-api-test-suite --depth 1
```

Install `npm` dependencies:
```sh
npm install
Expand Down
1 change: 1 addition & 0 deletions http/tests/vc-api/vc-api-test-suite
Submodule vc-api-test-suite added at 4923f0
22 changes: 9 additions & 13 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ $(TARGET)/release/$(LIB_NAME): $(RUST_SRC)
cargo build --lib --release
strip $@ || true

$(TARGET)/debug/$(LIB_NAME): $(RUST_SRC)
cargo build --lib

## C

$(TARGET)/test/c.stamp: $(TARGET)/cabi-test $(TARGET)/release/$(LIB_NAME) | $(TARGET)/test
LD_LIBRARY_PATH=$(TARGET)/release $(TARGET)/cabi-test
$(TARGET)/test/c.stamp: $(TARGET)/cabi-test $(TARGET)/debug/$(LIB_NAME) | $(TARGET)/test
LD_LIBRARY_PATH=$(TARGET)/debug $(TARGET)/cabi-test
touch $@

$(TARGET)/cabi-test: c/test.c $(TARGET)/release/$(LIB_NAME) $(TARGET)/didkit.h
$(CC) -I$(TARGET) -L$(TARGET)/release $< -ldl -ldidkit -o $@
$(TARGET)/cabi-test: c/test.c $(TARGET)/debug/$(LIB_NAME) $(TARGET)/didkit.h
$(CC) -I$(TARGET) -L$(TARGET)/debug $< -ldl -ldidkit -o $@

## Java

Expand All @@ -54,9 +57,9 @@ $(TARGET)/test/java.stamp: \
$(TARGET)/jvm/com/spruceid/DIDKit.class \
$(TARGET)/jvm/com/spruceid/DIDKitException.class \
$(TARGET)/jvm/com/spruceid/DIDKitTest.class \
$(TARGET)/release/$(LIB_NAME) | $(TARGET)/test
$(TARGET)/debug/$(LIB_NAME) | $(TARGET)/test
java -Djava.class.path=$(TARGET)/jvm \
-Djava.library.path=$(TARGET)/release \
-Djava.library.path=$(TARGET)/debug \
com.spruceid.DIDKitTest
touch $@

Expand Down Expand Up @@ -145,13 +148,6 @@ WEB_SRC=web/Cargo.toml $(wildcard web/src/*.rs)
install-wasm-pack:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

$(TARGET)/test/wasm.stamp: $(WEB_SRC) | $(TARGET)/test
cd web && wasm-pack build --target web --out-dir pkg/web
echo "No test was run"
# TODO write automated tests for at least Node.js, and maybe for the bundled output format.
# The existing web app installation didn't really make sense as the (dependency) installation has changed.
touch $@

## Cleanup

.PHONY: clean
Expand Down