Update and rename docker-image.yml to ci_action.yml #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
name: ci_action | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Build and push the Docker image | |
run: | |
docker build -t ${{ secrets.DOCKER_HUB_USER }}/sessions-project:githubactions ./src | |
docker push ${{ secrets.DOCKER_HUB_USER }}/sessions-project:githubactions | |
- uses: actions/checkout@v2 | |
- name: Install Python 3 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.13 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r src/requirements.txt | |
- name: Run tests with pytest | |
run: | |
cd .. | |
pytest |