Skip to content

Commit

Permalink
change image
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermecgs committed Aug 5, 2024
1 parent bf1f63a commit caa8a5b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
35 changes: 20 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
workflow:
name: 'CPF: $CPF'

image: selenium/standalone-chromium:126.0

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- .cache/pip3
- venv/

stages:
- build
- coverage_report
- relatorio

# Stage to build the Docker image
build:
stage: build
script:
- docker build -t chrome-with-selenium:latest .
artifacts:
paths:
- chrome-with-selenium.tar
when: always

before_script:
- python -V
- python3 -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
Expand All @@ -33,8 +36,9 @@ before_script:

coverage_html:
stage: coverage_report
image: chrome-with-selenium:latest
script:
- python coverage_test.py
- python3 coverage_test.py
- mkdir -p public/coverage_report
- mv coverage_report public/coverage_report
artifacts:
Expand All @@ -47,8 +51,9 @@ coverage_html:

relatorio:
stage: relatorio
image: chrome-with-selenium:latest
script:
- python ./ir.py --do check_environment_variables
# - python ./ir.py --do busca_trades_e_faz_merge_operacoes
- python ./ir.py --do calculo_ir --numero_de_meses 999
retry: 2
- python3 ./ir.py --do check_environment_variables
# - python3 ./ir.py --do busca_trades_e_faz_merge_operacoes
- python3 ./ir.py --do calculo_ir --numero_de_meses 999
retry: 2
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.10

# install google chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get -y update
RUN apt-get install -y google-chrome-stable

# install chromedriver
RUN apt-get install -yqq unzip
RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

# set display port to avoid crash
ENV DISPLAY=:99

# upgrade pip
RUN pip install --upgrade pip

# install selenium
RUN pip install selenium
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ reqs:
pip freeze > requirements.txt

coverage:
python coverage_test.py
python3 coverage_test.py

test:
pytest

run:
- python ./ir.py --do importar_negociacoes
- python ./ir.py --do calculo_ir --numero_de_meses 99
- python3 ./ir.py --do importar_negociacoes
- python3 ./ir.py --do calculo_ir --numero_de_meses 99
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
- Configurar as variaveis de ambiente conforme (https://github.com/guilhermecgs/ir/blob/master/tests/test_environment_variables.py)
- Voce pode executar tudo localmente e ver os resultados. Se quiser envio por email (SMTP), recomendo usar o https://elasticemail.com/ gratuitamente
- Executar os comandos abaixo:
- python ./ir.py --do check_environment_variables
- python ./ir.py --do busca_trades_e_faz_merge_operacoes
- python ./ir.py --do calculo_ir
- python ./ir.py --do importar_negociacoes
- python3 ./ir.py --do check_environment_variables
- python3 ./ir.py --do busca_trades_e_faz_merge_operacoes
- python3 ./ir.py --do calculo_ir
- python3 ./ir.py --do importar_negociacoes


## exemplo do relatorio gerado no seu email
Expand Down Expand Up @@ -56,7 +56,7 @@ Variáveis não definidas assumem os valores padrões definidos no arquivo `conf
![Exportar Negociações](imagens/exportar-negociacao.png)

2. Copie o arquivo exportado para pasta `importar`
3. Execute o comando para importar os arquivos: `python ./ir.py --do importar_negociacoes`
3. Execute o comando para importar os arquivos: `python3 ./ir.py --do importar_negociacoes`
4. Remova os arquivos da pasta `importar`

## disclaimer
Expand Down

0 comments on commit caa8a5b

Please sign in to comment.