diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3d362f..1e0ecf1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,27 +14,47 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip mypy + pip install -r src/main/docker/docker_root/requirements.txt + - name: Check static typing + run: mypy src/main/docker/docker_root/swarmclean.py + - name: Check formatting + run: | + pip install ruff + ruff format --diff src/main/docker/docker_root/swarmclean.py + # - name: Run tests + # run: | + # pip install -r src/test/requirements.txt + # pytest --cov --cov-report=xml + # - name: SonarCloud Scan + # uses: SonarSource/sonarcloud-github-action@master + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: temurin - name: Login to Docker - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: - registry: private.docker.xenit.eu + registry: open-source.docker.xenit.eu username: ${{ secrets.CLOUDSMITH_USER }} password: ${{ secrets.CLOUDSMITH_APIKEY }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 - name: Build docker image - uses: gradle/gradle-build-action@v2.3.3 - env: - BRANCH_NAME: ${{ github.ref_name }} - with: - arguments: buildDockerImage + run: ./gradlew buildDockerImage - name: Publish docker image if: ${{ startsWith(github.ref, 'refs/heads/master') }} - uses: gradle/gradle-build-action@v2.3.3 - env: - BRANCH_NAME: ${{ github.ref_name }} - with: - arguments: pushDockerImage \ No newline at end of file + run: ./gradlew pushDockerImage diff --git a/src/main/docker/docker_root/requirements.txt b/src/main/docker/docker_root/requirements.txt index b081416..8b9c4fe 100644 --- a/src/main/docker/docker_root/requirements.txt +++ b/src/main/docker/docker_root/requirements.txt @@ -1,6 +1,7 @@ configargparse requests[socks] records +attrs humanfriendly python-dateutil pytimeparse2 diff --git a/src/main/docker/docker_root/swarmclean.py b/src/main/docker/docker_root/swarmclean.py index 9965062..dcb52e6 100755 --- a/src/main/docker/docker_root/swarmclean.py +++ b/src/main/docker/docker_root/swarmclean.py @@ -14,7 +14,7 @@ import binascii from dateutil.parser import parse as parsedate import pytimeparse2 # type: ignore -from attr import define, field +from attr import define, field # type: ignore sys.path.insert(0, sys.path[0] + "/castorsdk") import scspHeaders # type: ignore