Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: 'Prepare environment'
description: 'Prepare environment'
description: Install Poetry and Python dependencies

runs:
using: "composite"
steps:
- name: Show ubuntu version
run: lsb_release -a
shell: bash
- run: sudo apt-get update
shell: bash
- name: Setup libraries
run: |
sudo apt-get install -y \
pipx
- name: Setup PATH
run: echo "/home/runner/.local/bin" >> $GITHUB_PATH
shell: bash

- name: Install Poetry
run: pipx install poetry==$(head -n 1 .poetry-version)
shell: bash

- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'poetry'

- name: Install dependencies
run: poetry install --only main,dev --no-interaction --no-ansi
run: poetry install --only main,dev --no-interaction --no-ansi --no-root
shell: bash

- name: Report versions
run: |
poetry --version
poetry run python --version
poetry run ruff --version
shell: bash
10 changes: 8 additions & 2 deletions .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ on:
pull_request_target:
types: [ opened, reopened ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: false

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: [self-hosted, small]
runs-on: arc-runners-small
timeout-minutes: 30
if: ${{ !github.event.pull_request.assignee }}
steps:
- uses: toshimaru/auto-author-assign@v2.1.1
- uses: toshimaru/auto-author-assign@v3.0.1
39 changes: 19 additions & 20 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
name: Format code

on:
pull_request:
push:
branches:
- main
- master
paths-ignore:
- .github/**
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: false
cancel-in-progress: true

permissions:
contents: write
actions: write

jobs:
format:
name: Format and lint with ruff
runs-on: [self-hosted, small]
runs-on: arc-runners-small
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Install Poetry
run: pipx install poetry==$(head -n 1 .poetry-version)

- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-interaction --no-ansi --no-root

- name: Check files using the ruff formatter
run: poetry run ruff format
- uses: ./.github/workflows/actions/prepare

- name: Check files using the ruff linter
run: poetry run ruff check --fix --unsafe-fixes --preview --exit-zero .
- run: poetry run ruff check --fix --unsafe-fixes --preview --exit-zero .
- run: poetry run ruff format .

- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
fetch: false
default_author: github_actions
message: 'Auto format'
add: '*.py'
add: '.'
32 changes: 17 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Deploy
name: CI

on:
push:
branches:
- 'master'
- master
pull_request:

concurrency:
Expand All @@ -11,20 +12,21 @@ concurrency:

jobs:
tests:
name: Tests
runs-on: [self-hosted, small]
steps:
- uses: actions/checkout@v4
name: Tests
runs-on: arc-runners-small
timeout-minutes: 30
steps:
- uses: actions/checkout@v6

- uses: ./.github/workflows/actions/prepare
- uses: ./.github/workflows/actions/prepare

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: hyperskill.azurecr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: hyperskill.azurecr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- run: docker pull hyperskill.azurecr.io/epicbox/python:3.11.5-c0347e7d1
- run: docker pull hyperskill.azurecr.io/epicbox/python:3.11.5-c0347e7d1

- run: poetry run pytest .
- run: poetry run pytest .
2 changes: 1 addition & 1 deletion epicbox/sandboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def working_directory() -> Iterator[WorkingDirectory]:
log.info("Creating new docker volume for working directory")
try:
volume = docker_client.volumes.create(volume_name)
except (RequestException, DockerException) as e:
except Exception as e:
log.exception("Failed to create a docker volume")
raise exceptions.DockerError(str(e)) from e
log.info("New docker volume is created")
Expand Down
Loading