Skip to content

Commit

Permalink
cicd: merge test files/add network/specify network in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Naramsim committed Dec 13, 2023
1 parent 72c87e3 commit d77214f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 42 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
name: Build Docker image
name: Tests

on:
pull_request:

jobs:
updater:
name: Test updater.sh script
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run and test
run: (cd updater && bash cmd.bash)
env:
BRANCH_NAME: updater-bot
COMMIT_AND_PUSH: false
COMMIT_EMAIL: ""
COMMIT_MESSAGE: "[Updater Bot] Regenerate data"
COMMIT_NAME: Updater Bot
REPO_DATA: https://github.com/PokeAPI/api-data.git
REPO_POKEAPI: https://github.com/PokeAPI/pokeapi.git
docker:
name: Build updater Docker image and test the updater.sh script
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -14,14 +31,6 @@ jobs:
uses: docker/metadata-action@v5
with:
images: pokeapi/updater
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -42,20 +51,10 @@ jobs:
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Run and test
run: (cd updater && bash cmd.bash)
env:
BRANCH_NAME: updater-bot
COMMIT_AND_PUSH: false
COMMIT_EMAIL: ""
COMMIT_MESSAGE: "[Updater Bot] Regenerate data"
COMMIT_NAME: Updater Bot
REPO_DATA: https://github.com/PokeAPI/api-data.git
REPO_POKEAPI: https://github.com/PokeAPI/pokeapi.git
- name: Run and test
run: |
docker network create pokeapi
docker run --privileged -e 'COMMIT_AND_PUSH=false' -e "REPO_APIDATA_CHECKOUT_OBJECT=${{ github.sha }}" -e 'REPO_POKEAPI=https://github.com/PokeAPI/pokeapi.git' -e 'REPO_DATA=https://github.com/PokeAPI/api-data.git' --rm ${{ steps.meta.outputs.tags }}
docker run --privileged --network pokeapi --network-alias docker -e 'COMMIT_AND_PUSH=false' -e "REPO_APIDATA_CHECKOUT_OBJECT=${{ github.sha }}" -e 'REPO_POKEAPI=https://github.com/PokeAPI/pokeapi.git' -e 'REPO_DATA=https://github.com/PokeAPI/api-data.git' --rm ${{ steps.meta.outputs.tags }}
- name: Image digest and tag
run: |
echo ${{ steps.docker_build.outputs.digest }}
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/updater.yml

This file was deleted.

3 changes: 2 additions & 1 deletion updater/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Launch the bot with a volume containing the SSH keys to `/root/.ssh` and an envi
Since this container runs [Docker](https://hub.docker.com/_/docker) within itself, it needs to run in privileged mode.

```sh
docker run --privileged -v ~/.ssh:/root/.ssh -e [email protected] quay.io/pokeapi/updater
docker network create pokeapi
docker run --privileged --network pokeapi --network-alias docker -v ~/.ssh:/root/.ssh -e [email protected] quay.io/pokeapi/updater
```

Check the log for failed clones, sometimes <img src="https://veekun.com/dex/media/pokemon/global-link/129.png" alt="Magikarp" height="20"/> times out.
Expand Down

0 comments on commit d77214f

Please sign in to comment.