-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cargo|pnpm tests are now executed during CI
- Loading branch information
1 parent
be374b2
commit 569f05d
Showing
1 changed file
with
64 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,64 @@ | ||
name: Docker CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and Test Docker Image on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
# macos-13 commented ; for now, this config takes more than 30mn to process within github action | ||
# - macos-13 # ( by default; 13 -> intel chipset) | ||
# - windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install and run docker env. on Macos | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
brew install colima | ||
brew install docker docker-compose | ||
mkdir -p ~/.docker/cli-plugins | ||
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose | ||
colima start | ||
- name: Build and Run Docker Compose | ||
run: | | ||
docker compose -f docker/compose.yml up --build -d | ||
- name: Check if container is running | ||
run: | | ||
docker ps --filter "name=tuono-source-container" --format "table {{.Names}}\t{{.Status}}" | ||
if ! docker ps --filter "name=tuono-source-container" --format "{{.Status}}" | grep -q "Up"; then | ||
echo "Error: Container 'tuono-source-container' is not running." | ||
exit 1 | ||
fi | ||
- name: Check commands inside container | ||
run: | | ||
docker exec tuono-source-container pnpm --version || { echo "Error: pnpm is not available."; exit 1; } | ||
docker exec tuono-source-container tuono --version || { echo "Error: tuono is not available."; exit 1; } | ||
- name: Tear Down Docker Compose | ||
if: always() | ||
run: | | ||
docker compose -f docker/compose.yml down --volumes | ||
name: Docker CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- "chore-add-image-build-test-to-github-actions" | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and Test Docker Image on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
# macos-13 commented ; for now, this config takes more than 30mn to process within github action | ||
# - macos-13 # ( by default; 13 -> intel chipset) | ||
# - windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install and run docker env. on Macos | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
brew install colima | ||
brew install docker docker-compose | ||
mkdir -p ~/.docker/cli-plugins | ||
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose | ||
colima start | ||
- name: Build and Run Docker Compose | ||
run: | | ||
docker compose -f docker/compose.yml up --build -d | ||
- name: Check if container is running | ||
run: | | ||
docker ps --filter "name=tuono-source-container" --format "table {{.Names}}\t{{.Status}}" | ||
if ! docker ps --filter "name=tuono-source-container" --format "{{.Status}}" | grep -q "Up"; then | ||
echo "Error: Container 'tuono-source-container' is not running." | ||
exit 1 | ||
fi | ||
- name: Check commands inside container | ||
run: | | ||
docker exec tuono-source-container pnpm --version || { echo "Error: pnpm is not available."; exit 1; } | ||
docker exec tuono-source-container tuono --version || { echo "Error: tuono is not available."; exit 1; } | ||
- name: run cargo test | ||
run: docker exec tuono-source-container cargo test | ||
|
||
- name : Install node dependencies in each tuono's sub-projets | ||
run : docker exec tuono-source-container bash -c 'for dir in /tuono/packages/*; do [ -d "$dir" ] && (cd "$dir" && yes | pnpm install --frozen-lockfile); done' | ||
|
||
- name: run pnpm test | ||
run: docker exec tuono-source-container pnpm test | ||
|
||
- name: Tear Down Docker Compose | ||
if: always() | ||
run: | | ||
docker compose -f docker/compose.yml down --volumes |