Adding the new rewrite
This commit is contained in:
1 parent
4aca9f08d1
commit
9b48b01d1d
62 files changed
+4510
-1406
No files matched your search
@@ -1,37 +1,63 @@
|
||||
name: Build and Push Docker Image
|
||||
# This workflow is manually triggered from the "Actions" tab in GitHub.
|
||||
# It requires a single input: the version tag of the flood repository to use.
|
||||
name: CI - Lint, Test, and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: '0 0 3 * *' # This runs at midnight on the first day of every month
|
||||
- cron: '0 0 3 * *' # monthly refresh
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
cache: pip
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install coverage
|
||||
|
||||
- name: Ruff lint
|
||||
run: ruff check .
|
||||
|
||||
- name: Run pytest with coverage
|
||||
run: |
|
||||
coverage run -m pytest tests/ -v
|
||||
coverage report
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: lint-and-test
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- name: Set Image name
|
||||
run: |
|
||||
echo "IMAGE_NAME=k2patel/apcupsd-client:latest" >> $GITHUB_ENV
|
||||
- name: Set Image name
|
||||
run: |
|
||||
echo "IMAGE_NAME=k2patel/apcupsd-client:latest" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build the Docker image
|
||||
id: build
|
||||
run: |
|
||||
docker build . -t ${{ env.IMAGE_NAME }}
|
||||
- name: Build the Docker image
|
||||
id: build
|
||||
run: |
|
||||
docker build . -t ${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Push the Docker image
|
||||
run: docker push ${{ env.IMAGE_NAME }}
|
||||
- name: Push the Docker image
|
||||
run: docker push ${{ env.IMAGE_NAME }}
|
||||
Reference in new issue
Block a user