2023-05-19 03:46:51 +00:00
|
|
|
name: Run tests
|
|
|
|
on:
|
2023-09-20 06:22:46 +00:00
|
|
|
- pull_request
|
|
|
|
|
|
|
|
env:
|
|
|
|
# Needed until we can incorporate docker startup into the executor container
|
|
|
|
DOCKER_HOST: unix:///var/run/dind.sock
|
2023-05-19 03:46:51 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-09-20 06:22:46 +00:00
|
|
|
unit-tests:
|
|
|
|
name: Run unit tests
|
2023-05-19 03:46:51 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-09-08 21:54:49 +00:00
|
|
|
- uses: actions/setup-go@v4
|
2023-05-19 03:46:51 +00:00
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
check-latest: true
|
2023-09-20 06:22:46 +00:00
|
|
|
- name: Run dockerd
|
|
|
|
run: |
|
|
|
|
dockerd -H $DOCKER_HOST --userland-proxy=false &
|
|
|
|
sleep 5
|
|
|
|
- name: Run DB container
|
2023-05-19 03:46:51 +00:00
|
|
|
working-directory: ./test
|
2023-09-08 21:54:49 +00:00
|
|
|
run: docker compose up --wait --quiet-pull
|
2023-09-20 06:22:46 +00:00
|
|
|
- name: Set Gitea access token
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
|
2023-05-19 03:46:51 +00:00
|
|
|
run: |
|
2023-09-20 06:22:46 +00:00
|
|
|
git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/
|
2023-05-19 03:46:51 +00:00
|
|
|
|
2023-09-20 06:22:46 +00:00
|
|
|
- name: Build and run tests
|
|
|
|
run: |
|
|
|
|
until [[ "$(docker inspect -f '{{.State.Status}}' test-ipld-eth-db)" = 'running' ]]
|
|
|
|
do sleep 1; done &
|
2023-05-19 03:46:51 +00:00
|
|
|
go build ./...
|
|
|
|
wait $!
|
2023-09-20 06:22:46 +00:00
|
|
|
go test -p 1 -v ./...
|