Skip to content

Commit

Permalink
Using devbox instead of github action dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Sep 2, 2024
1 parent e18526a commit f149d3b
Show file tree
Hide file tree
Showing 24 changed files with 5,192 additions and 2,904 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
target-dir = "./target-common"

42 changes: 23 additions & 19 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@ jobs:
continue-on-error: false
with:
path: |
target-common
.devbox
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target/
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-build-
cargo
cargo-build
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: 'true'

- name: Run cargo_build
shell: bash
run: |
make cargo_build
run: devbox run -- make cargo_build

cargo_test:
runs-on: ubuntu-latest
Expand All @@ -47,20 +50,24 @@ jobs:
continue-on-error: false
with:
path: |
target-common
.devbox
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target/
key: cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-test
cargo-build
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: 'true'

- name: Run cargo_test
shell: bash
run: |
make cargo_test
run: devbox run -- make cargo_test

make_test:
runs-on: ubuntu-latest
Expand All @@ -76,24 +83,21 @@ jobs:
continue-on-error: false
with:
path: |
target-common
.devbox
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target/
key: cargo-make_test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-make_test
cargo-build
- name: Install trunk
run: which trunk || cargo install --locked trunk

- uses: jetli/wasm-pack-action@v0.3.0
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
version: 'latest'
enable-cache: 'true'

- name: Run make_test
shell: bash
run: |
make make_test
run: devbox run -- make make_test
78 changes: 37 additions & 41 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Docker Build
on:
push:
pull_request:
branches:
- main

Expand All @@ -10,52 +10,40 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: jetli/wasm-pack-action@v0.3.0
with:
version: 'latest'

- uses: jetli/trunk-action@v0.5.0
with:
version: 'v0.20.3'

- name: Add wasm target
run: rustup target add wasm32-unknown-unknown

- name: Set up cargo cache
uses: actions/cache@v4
continue-on-error: false
with:
path: |
target-common
.devbox
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target/
key: cargo-docker-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-docker
cargo-build
cargo
- name: Update build tag
run: make update_version

- name: Build signal server
run: cd cli && cargo build --release -p flsignal
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: 'true'

- name: Build flnode for docker server
run: cd cli && cargo build --release -p fledger
- name: Update build tag
run: devbox run -- make update_version

- name: Build web server
run: cd flbrowser && trunk build
- name: Build servers
run: devbox run -- make build_cli_release build_web

- name: Docker build signal
uses: mr-smithers-excellent/docker-build-push@v5
with:
image: fledgre/flsignal
registry: docker.io
dockerfile: Dockerfile.flsignal
directory: cli/target/release
directory: target-common/release
username: ${{ secrets.DOCKERHUB_NAME }}
password: ${{ secrets.DOCKERHUB }}
tags: latest
Expand All @@ -66,7 +54,7 @@ jobs:
image: fledgre/fledger
registry: docker.io
dockerfile: Dockerfile.fledger
directory: cli/target/release
directory: target-common/release
username: ${{ secrets.DOCKERHUB_NAME }}
password: ${{ secrets.DOCKERHUB }}
tags: latest
Expand All @@ -88,23 +76,31 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: 'true'

- name: show directory
run: ls

- name: Publish new crates, if any
run: make publish
run: devbox run -- make publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

deploy:
runs-on: ubuntu-latest
needs: docker

steps:
- name: Update signal.fledg.re
uses: appleboy/ssh-action@master
with:
host: signal.fledg.re
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
docker-compose pull -q
docker-compose down
docker-compose up -d
# deploy:
# runs-on: ubuntu-latest
# needs: docker

# steps:
# - name: Update signal.fledg.re
# uses: appleboy/ssh-action@master
# with:
# host: signal.fledg.re
# username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_KEY }}
# script: |
# docker-compose pull -q
# docker-compose down
# docker-compose up -d
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target-common/
target/
.cargo
.idea
.vscode
femme
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ publish:
CARGO_VERSION=$$(grep "^version" $$crate/Cargo.toml | head -n 1 | sed -e "s/.*\"\(.*\)\".*/\1/"); \
if [[ "$$CRATE_VERSION" != "$$CARGO_VERSION" ]]; then \
echo "Publishing crate $$crate"; \
cargo publish --token $$CARGO_REGISTRY_TOKEN --manifest-path $$crate/Cargo.toml; \
cargo publish -n --token $$CARGO_REGISTRY_TOKEN --manifest-path $$crate/Cargo.toml; \
fi; \
done

Expand All @@ -65,15 +65,23 @@ kill:
$(call PKILL,fledger)
$(call PKILL,trunk serve)

build_cli:
cd cli && cargo build -p fledger && cargo build -p flsignal

build_cli_release:
cd cli && cargo build --release -p fledger && cargo build --release -p flsignal

build_web:
cd flbrowser && trunk build

build_servers: build_cli build_web

build_local_web:
cd flbrowser && trunk build --features local

build_local_cli:
cd cli && cargo build -p fledger && cargo build -p flsignal

build_local: build_local_web build_local_cli
build_local: build_local_web build_cli

serve_two: kill build_local_cli
serve_two: kill build_cli
( cd cli && cargo run --bin flsignal -- -vv ) &
sleep 4
( cd cli && ( cargo run --bin fledger -- --config fledger/flnode -vv -s ws://localhost:8765 & \
Expand Down
Loading

0 comments on commit f149d3b

Please sign in to comment.