Add code snippets package for jaspr_content
#92
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| # Make sure everything is still working by running the CI weekly. | |
| - cron: "0 5 * * 1" | |
| jobs: | |
| # Note: Keep the compile_ jobs in sync with release_weblocks.yaml | |
| compile_native_linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,riscv64gc-unknown-linux-gnu,armv7-unknown-linux-gnueabihf,aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "weblocks/native" | |
| - run: cargo install cargo-ndk | |
| - name: Install cross-compiling GCC | |
| run: | | |
| sudo apt install -y gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu gcc-arm-linux-gnueabihf | |
| - name: Build x64 | |
| working-directory: weblocks/native | |
| run: cargo build --release --target x86_64-unknown-linux-gnu | |
| - name: Build aarch64 | |
| working-directory: weblocks/native | |
| run: cargo build --release --target aarch64-unknown-linux-gnu | |
| - name: Build armv7 | |
| working-directory: weblocks/native | |
| run: cargo build --release --target armv7-unknown-linux-gnueabihf | |
| - name: Build riscv64gc | |
| working-directory: weblocks/native | |
| run: cargo build --release --target riscv64gc-unknown-linux-gnu | |
| - name: Build Android libs | |
| working-directory: weblocks/native | |
| run: cargo ndk -t armeabi-v7a -t arm64-v8a -t x86_64 -o target/android build --release | |
| - name: Copy libraries | |
| working-directory: weblocks/native | |
| run: | | |
| mkdir out | |
| cp target/x86_64-unknown-linux-gnu/release/libdart_locks.so out/libdart_locks.linux_x64.so | |
| cp target/aarch64-unknown-linux-gnu/release/libdart_locks.so out/libdart_locks.linux_aarch64.so | |
| cp target/armv7-unknown-linux-gnueabihf/release/libdart_locks.so out/libdart_locks.linux_arm7.so | |
| cp target/riscv64gc-unknown-linux-gnu/release/libdart_locks.so out/libdart_locks.linux_riscv.so | |
| cp target/android/x86_64/libdart_locks.so out/libdart_locks.android_x86_64.so | |
| cp target/android/armeabi-v7a/libdart_locks.so out/libdart_locks.android_v7a.so | |
| cp target/android/arm64-v8a/libdart_locks.so out/libdart_locks.android_v8a.so | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: locks-linux | |
| retention-days: 1 | |
| path: weblocks/native/out | |
| compile_native_macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-apple-darwin,aarch64-apple-darwin,aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios | |
| - name: Build macOS | |
| working-directory: weblocks/native | |
| run: | | |
| cargo build --release --target x86_64-apple-darwin | |
| cargo build --release --target aarch64-apple-darwin | |
| - name: Build iOS | |
| working-directory: weblocks/native | |
| run: | | |
| cargo build --release --target aarch64-apple-ios | |
| cargo build --release --target aarch64-apple-ios-sim | |
| cargo build --release --target x86_64-apple-ios | |
| - name: Copy libraries | |
| working-directory: weblocks/native | |
| run: | | |
| mkdir out | |
| cp target/x86_64-apple-darwin/release/libdart_locks.dylib out/libdart_locks.macos_x64.dylib | |
| cp target/aarch64-apple-darwin/release/libdart_locks.dylib out/libdart_locks.macos_aarch64.dylib | |
| cp target/aarch64-apple-ios/release/libdart_locks.dylib out/libdart_locks.ios_aarch64.dylib | |
| cp target/aarch64-apple-ios-sim/release/libdart_locks.dylib out/libdart_locks.ios_sim_aarch64.dylib | |
| cp target/x86_64-apple-ios/release/libdart_locks.dylib out/libdart_locks.ios_sim_x64.dylib | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: locks-apple | |
| retention-days: 1 | |
| path: weblocks/native/out | |
| compile_native_windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc | |
| - name: Build Windows | |
| working-directory: weblocks/native | |
| run: | | |
| cargo build --release --target x86_64-pc-windows-msvc | |
| cargo build --release --target aarch64-pc-windows-msvc | |
| - name: Copy libraries | |
| working-directory: weblocks/native | |
| run: | | |
| mkdir out | |
| cp target/x86_64-pc-windows-msvc/release/dart_locks.dll out/dart_locks.win_x64.dll | |
| cp target/aarch64-pc-windows-msvc/release/dart_locks.dll out/dart_locks.win_aarch64.dll | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: locks-windows | |
| retention-days: 1 | |
| path: weblocks/native/out | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| dart-version: ${{ steps.setup-dart.outputs.dart-version }} | |
| cache-key: dart-packages-${{ steps.deps-after.outputs.lockfiles }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| id: setup-dart | |
| with: | |
| sdk: beta | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| shelf_multipart/pubspec.lock | |
| weblocks/pubspec.lock | |
| jaspr_content_snippets/pubspec.lock | |
| # We can only use fallback keys here since we don't know the lockfile contents yet. | |
| key: dart-packages-stub | |
| restore-keys: | | |
| dart-packages- | |
| - name: "Hash pubspec lockfiles before pub upgrade" | |
| id: deps-before | |
| run: | | |
| echo "lockfiles=${{ hashFiles('**/pubspec.lock') }}" >> $GITHUB_OUTPUT | |
| - name: Install dependencies | |
| run: |- | |
| pushd shelf_multipart | |
| dart pub upgrade | |
| popd | |
| pushd weblocks | |
| dart pub upgrade | |
| popd | |
| pushd jaspr_content_snippets | |
| dart pub upgrade | |
| popd | |
| - name: "Hash pubspec lockfiles after pub upgrade" | |
| id: deps-after | |
| run: | | |
| echo "lockfiles=${{ hashFiles('**/pubspec.lock') }}" >> $GITHUB_OUTPUT | |
| - name: "Update cache due to changed pubspec.lock" | |
| if: ${{ !failure() && ( steps.deps-after.outputs.lockfiles != steps.deps-before.outputs.lockfiles) }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| shelf_multipart/pubspec.lock | |
| weblocks/pubspec.lock | |
| key: dart-packages-${{ steps.deps-after.outputs.lockfiles }} | |
| shelf_multipart: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| defaults: | |
| run: | |
| working-directory: shelf_multipart | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ needs.setup.outputs.dart-version }} | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| shelf_multipart/pubspec.lock | |
| key: ${{ needs.setup.outputs.cache-key }} | |
| fail-on-cache-miss: false #true | |
| - name: Install dependencies | |
| run: dart pub get # --offline | |
| - name: Verify format | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: Analyze project | |
| run: dart analyze --fatal-infos | |
| - name: Run tests | |
| run: dart test | |
| weblocks: | |
| runs-on: ubuntu-latest | |
| needs: [setup, compile_native_linux, compile_native_macos, compile_native_windows] | |
| defaults: | |
| run: | |
| working-directory: weblocks | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ needs.setup.outputs.dart-version }} | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| weblocks/pubspec.lock | |
| key: ${{ needs.setup.outputs.cache-key }} | |
| fail-on-cache-miss: false #true | |
| - name: Install dependencies | |
| run: dart pub get # --offline | |
| - name: Verify format | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: Analyze project | |
| run: dart analyze --fatal-infos | |
| - name: Download libs | |
| uses: actions/download-artifact@v5 | |
| with: | |
| merge-multiple: true | |
| path: weblocks/assets | |
| - run: find assets | |
| working-directory: weblocks | |
| - name: Run tests | |
| run: dart test | |
| jaspr_content_snippets: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| defaults: | |
| run: | |
| working-directory: jaspr_content_snippets | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: ${{ needs.setup.outputs.dart-version }} | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{ env.PUB_CACHE }} | |
| shelf_multipart/pubspec.lock | |
| key: ${{ needs.setup.outputs.cache-key }} | |
| fail-on-cache-miss: false #true | |
| - name: Install dependencies | |
| run: dart pub get # --offline | |
| - name: Run builder | |
| run: dart run build_runner build -d | |
| - name: Verify format | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: Analyze project | |
| run: dart analyze --fatal-infos | |
| - name: Run tests | |
| run: dart test |