Merge pull request #409 from es-na-battlesnake/dependabot/bundler/act… #1054
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: Docker Image CI - Pull Request | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.17.1' | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag code-snek:pr | |
- name: Setup Docker network | |
run: docker network create test | |
- name: Run the Docker image | |
run: docker run -d -p 4567:4567 --network test --name code-snek code-snek:pr | |
- name: Output image log | |
run: sleep 2 && docker ps && docker logs code-snek | |
- name: Test snake1 app response | |
run: docker run --rm --network test curlimages/curl:latest --connect-timeout 10 --retry 5 --retry-delay 2 --retry-connrefused http://code-snek:4567/ | |
- name: Test GoSnek app response | |
run: docker run --rm --network test curlimages/curl:latest --connect-timeout 10 --retry 5 --retry-delay 2 --retry-connrefused http://code-snek:8081/ | |
- name: Rspec test djdefi snake | |
run: docker exec code-snek bundle config unset without && docker exec code-snek bundle config set with 'dev' && docker exec code-snek bundle config unset frozen && docker exec code-snek bundle update && docker exec code-snek /bin/bash -c 'script/test djdefi' | |
- name: Create status check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
BUILD_COMMIT=$(git rev-parse HEAD) | |
curl \ | |
-X POST \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/es-na-battlesnake/starter-snake-ruby/check-runs \ | |
-d '{"name":"PR build", "head_sha": "'"$BUILD_COMMIT"'", "status": "completed", "conclusion": "success" }' |