diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..5231ca1 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,33 @@ +name: Build and publish Docker image for the project + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + Docker: + if: github.repository == 'antmicro/dl-in-iot-course' + runs-on: ubuntu-latest + steps: + - name: Cancel previous run + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + - name: Checkout sources + uses: actions/checkout@v4 + - name: Build Docker image + run: docker build . -f environments/Dockerfile --tag ghcr.io/${{ github.repository }} + - name: Login to registry + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Push image to registry + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + run: docker push ghcr.io/${{ github.repository }} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 000242c..0000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Flake8 - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - flake8: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Install flake8 - run: pip install -U flake8 - - name: Run flake8 - run: flake8 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..46a7425 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,20 @@ +name: pre-commit checks + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - name: Run pre-commit + uses: pre-commit/action@v3.0.0