diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..853732e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,71 @@ +name: GitHub Workflow + +on: + workflow_dispatch: + inputs: + epochs: + description: 'Number of epochs' + required: true + default: '10' + +jobs: + build-and-train: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/training-model:latest + + - name: Run training + run: docker run ${{ secrets.DOCKERHUB_USERNAME }}/training-model:latest python3 ../../train.py --epochs ${{ github.event.inputs.epochs }} + + evaluate: + needs: build-and-train + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pandas numpy tensorflow scikit-learn matplotlib + + - name: Run evaluation + run: python ../../evaluate.py + + archive: + needs: evaluate + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Archive model + run: tar -czvf ../../model.tar.gz ../../model.h5 + + - name: Upload model + uses: actions/upload-artifact@v2 + with: + name: model + path: ../../model.tar.gz