[spore-drive] handle embed service #260 #78
Workflow file for this run
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
name: pre-commit | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.0' | |
- name: Install Go tools | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- uses: pre-commit/[email protected] | |
tests: | |
runs-on: ubuntu-latest | |
needs: pre-commit | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: --privileged # required for nested containers | |
ports: | |
- 2375:2375 | |
volumes: | |
- /var/lib/docker | |
steps: | |
- name: Set up Docker environment | |
run: | | |
docker info | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.0' | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Add entry to /etc/hosts | |
run: | | |
echo "127.0.0.1 hal.computers.com" | sudo tee -a /etc/hosts | |
- name: Run Go tests with retries | |
env: | |
TEST_GIT_TOKEN: ${{ secrets.TEST_GIT_TOKEN }} | |
run: | | |
max_attempts=5 | |
attempt_num=1 | |
until [ $attempt_num -gt $max_attempts ] | |
do | |
echo "Attempt $attempt_num of $max_attempts" | |
go test -p 1 ./... && break || echo "Test failed. Retrying..." | |
attempt_num=$((attempt_num + 1)) | |
if [ $attempt_num -gt $max_attempts ] | |
then | |
echo "All test attempts failed." | |
exit 1 | |
fi | |
sleep 5 | |
done | |
- name: Run JS/TS tests with retries | |
run: | | |
max_attempts=5 | |
attempt_num=1 | |
cd pkg/spore-drive/clients/js | |
npm i | |
until [ $attempt_num -gt $max_attempts ] | |
do | |
echo "Attempt $attempt_num of $max_attempts" | |
npm run test && break || echo "Test failed. Retrying..." | |
attempt_num=$((attempt_num + 1)) | |
if [ $attempt_num -gt $max_attempts ] | |
then | |
echo "All test attempts failed." | |
exit 1 | |
fi | |
sleep 5 | |
done |