Skip to content

Readmeupdate

Readmeupdate #28

Workflow file for this run

name: Main
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: traveltunes:latest
- name: Test Docker image
env:
SPOTIPY_CLIENT_SECRET: ${{ secrets.SPOTIPY_CLIENT_SECRET }}
SPOTIPY_CLIENT_ID: ${{ secrets.SPOTIPY_CLIENT_ID }}
SPOTIPY_REDIRECT_URI: ${{ secrets.SPOTIPY_REDIRECT_URI }}
SPOTIPY_TOKEN: ${{ secrets.SPOTIPY_TOKEN }}
run: |
docker run -d -e SPOTIPY_CLIENT_SECRET -e SPOTIPY_CLIENT_ID -e SPOTIPY_REDIRECT_URI -e SPOTIPY_TOKEN -p 5000:5000 traveltunes:latest
sleep 5 # Donne un peu de temps au conteneur pour démarrer
curl --retry 10 --retry-delay 5 -v http://127.0.0.1:5000/
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Test with pytest
run: |
pytest
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: [build-docker, tests]
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/traveltunes
tags: |
type=sha,prefix=main-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}