Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pokédex CI

on:
push:
branches: ["master-pokeapi"]
pull_request:
branches: ["master-pokeapi"]

env:
ENABLE_TTY: 0

jobs:
Docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
run: |
bin/docker-pokedex setup -v
- name: Dump Pokédex
run: |
bin/docker-pokedex dump -l all

Python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Run Setup
run: |
pokedex setup
- name: Dump DB
run: |
pokedex dump -l all
19 changes: 14 additions & 5 deletions bin/docker-pokedex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

curr_dir="$(pwd)"
log_file="${curr_dir}/bin/docker-pokedex.log"
ENABLE_TTY=${ENABLE_TTY:-1}

if [[ "${1}" = "rebuild" ]] || [[ ! -f "${log_file}" ]]; then
docker build --rm -t veekun/pokedex ${curr_dir}
Expand All @@ -13,8 +14,16 @@ if [[ "${1}" = "rebuild" ]] || [[ ! -f "${log_file}" ]]; then
fi;
fi

docker run -it --rm \
-e TERM=xterm-256color \
--name "pokedex-$(date +%Y%m%d-%H%M%S)" \
--mount type=bind,source="${curr_dir}/pokedex/data",target=/app/pokedex/data \
veekun/pokedex "${@}"
options=(
run
--rm
-e TERM=xterm-256color
--name "pokedex-$(date +%Y%m%d-%H%M%S)"
--mount type=bind,source="${curr_dir}/pokedex/data",target=/app/pokedex/data \
veekun/pokedex "${@}"
)
if [ "$ENABLE_TTY" -ne 0 ]; then
options+=(-it)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Action doesn't support TTY.
So on CI, -it has to be got rid of.

fi

docker ${options[@]}