Skip to content

Commit

Permalink
fix: workflow & add loop.sh
Browse files Browse the repository at this point in the history
Lanznx committed Mar 26, 2023
1 parent 1601ea1 commit dd11ad6
Showing 2 changed files with 15 additions and 22 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/api-test.yaml
Original file line number Diff line number Diff line change
@@ -8,33 +8,15 @@ on:
branches: [main]

jobs:
Prepare-matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update test yaml
run: node renewFolder.js

test:
runs-on: ubuntu-latest
needs: Prepare-matrix
strategy:
matrix:
directory: [demo, student-a, student-acopy, student-acopy2]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: ls
run: ls

- name: Build and test
env:
DIRECTORY: ${{ matrix.directory }}
run: |
cd $DIRECTORY
docker compose up -d
npm install
npm run test
docker compose down
run: bash ./loop.sh
11 changes: 11 additions & 0 deletions loop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# 遍歷當前目錄下的所有子目錄,排除 .github 和 .git
for d in */; do
if [[ $d != ".github/" && $d != ".git/" ]]; then
docker compose up -d
npm install
npm run test
docker compose down
fi
done

0 comments on commit dd11ad6

Please sign in to comment.