-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from Kegbot/mikey/docker-workflows
Update actions
- Loading branch information
Showing
8 changed files
with
187 additions
and
99 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Docker Build (amd64) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.build.outputs.platforms }} | ||
- | ||
name: Build | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64 \ | ||
-t current \ | ||
--load . | ||
- | ||
name: Login to DockerHub Registry | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | ||
- | ||
name: Tag as latest | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: | | ||
docker tag current kegbot/server:latest | ||
- | ||
name: Publish | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: | | ||
docker push kegbot/server:latest |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Docker Build (armv7) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.build.outputs.platforms }} | ||
- | ||
name: Build | ||
run: | | ||
docker buildx build \ | ||
--platform linux/arm/v7 \ | ||
-t current \ | ||
--load . | ||
- | ||
name: Login to DockerHub Registry | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin | ||
- | ||
name: Tag as latest-arm | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: | | ||
docker tag current kegbot/server:latest-arm | ||
- | ||
name: Publish | ||
if: success() && github.ref == 'refs/heads/master' | ||
run: | | ||
docker push kegbot/server:latest-arm |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Python Build & Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
py_build_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pipenv docker-compose | ||
pipenv install --deploy --dev | ||
- name: Run mysql & redis | ||
run: | | ||
docker-compose -f testdata/test-docker-compose.yml up -d | ||
sleep 10 && ./bin/wait-for-container.sh testdata_mysql_1 | ||
- name: pytest | ||
run: KEGBOT_DATABASE_URL=mysql://root:[email protected]:3306/kegbot_dev pipenv run pytest |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
MAX_ATTEMPTS=60 | ||
|
||
function getContainerHealth { | ||
docker inspect --format "{{.State.Health.Status}}" $1 | ||
} | ||
|
||
function waitContainer { | ||
attempts=0 | ||
while STATUS=$(getContainerHealth $1); [ $STATUS != "healthy" ]; do | ||
if [ $STATUS == "unhealthy" ]; then | ||
echo "container is unhealthy" | ||
exit -1 | ||
fi | ||
echo "container $1: status $STATUS ..." | ||
lf=$'\n' | ||
attempts=$[$attempts+1] | ||
if [ $attempts -ge $MAX_ATTEMPTS ]; then | ||
echo "Max attempts reached; fail" | ||
exit -1 | ||
fi | ||
sleep 1 | ||
done | ||
echo "Container is up!" | ||
} | ||
|
||
waitContainer $1 |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# docker-compose for use in continuous integration | ||
# Not for production! | ||
|
||
version: '3' | ||
services: | ||
mysql: | ||
image: mysql:latest | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 'changeme' | ||
MYSQL_USER: 'kegbot_dev' | ||
MYSQL_PASSWORD: 'changeme' | ||
MYSQL_DATABASE: 'kegbot_dev' | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "--silent"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 3 | ||
volumes: | ||
- mysql-data:/var/lib/mysql | ||
ports: | ||
- "3306:3306" | ||
|
||
redis: | ||
image: redis:latest | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
|
||
volumes: | ||
mysql-data: | ||
kegbot-data: |