docs: Added more docs to repo. #2
This file contains hidden or 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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| - name: Run tests | |
| run: | | |
| pytest --cov=app tests/ | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Remove existing test container | |
| run: | | |
| # if a container named jobspy-api-test exists, remove it | |
| if [ "$(docker ps -a -q -f name=jobspy-api-test)" ]; then | |
| docker rm -f jobspy-api-test | |
| fi | |
| - name: Build Docker image | |
| run: docker build -t jobspy-api . | |
| - name: Run Docker container | |
| run: docker run -d -p 8000:8000 --name jobspy-api-test jobspy-api | |
| - name: Test Docker container | |
| run: | | |
| sleep 5 # Wait for container to start | |
| curl -f http://localhost:8000/health || exit 1 |