Skip to content

Commit

Permalink
Set up devcontainer with Python but without Poetry (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiedxu authored Nov 1, 2023
1 parent d0e0c5e commit 48c7c29
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "cmdict",

"image": "mcr.microsoft.com/devcontainers/python:3.8",

"remoteUser": "vscode",

"postCreateCommand": "poetry install --with pdf,dev,check",

"features": {
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},

"customizations": {
"vscode": {
"extensions": [
"bungcip.better-toml",
"redhat.vscode-yaml",
"shd101wyy.markdown-preview-enhanced"
]
}
}
}
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- '.python-version'
- 'poetry.toml'
- '.github/workflows/cd.yml'
- '.github/workflows/devcontainer.yml'
- '.devcontainer/**'
pull_request:
branches: [ master ]
paths-ignore:
Expand All @@ -21,6 +23,8 @@ on:
- '.python-version'
- 'poetry.toml'
- '.github/workflows/cd.yml'
- '.github/workflows/devcontainer.yml'
- '.devcontainer/**'
workflow_dispatch:
schedule:
- cron: '30 5 * * 1'
Expand All @@ -39,7 +43,7 @@ jobs:
python-version: "3.7"
- name: Install pre-commit
run: |
pip install pre-commit==2.9.2
pip install pre-commit==2.21.0
- name: Run pre-commit
run: |
pre-commit install
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: devcontainer

on:
push:
branches: [ master ]
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
- 'codecov.yml'
- '.python-version'
- 'poetry.toml'
- '.github/workflows/cd.yml'
- '.github/workflows/ci.yml'
pull_request:
branches: [ master ]
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
- 'codecov.yml'
- '.python-version'
- 'poetry.toml'
- '.github/workflows/cd.yml'
- '.github/workflows/ci.yml'
workflow_dispatch:
schedule:
- cron: '30 5 * * 1'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
unit-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Run unit tests in dev container
uses: devcontainers/ci@v0.3
with:
imageName: cmdict-devcontainer
push: never
runCmd: |
poetry run pre-commit install
poetry run pre-commit run --all-files
poetry run pytest tests/ -s
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`cmdict` not only is an English-to-Chinese dictionary application with a command-line interface, but also provide out-of-box features like extracting highlighted words from a PDF file. It runs on Linux, macOS, and Windows. Additionally, it can be used as a Python package.

## Installation
## How to install

The easiest way is to use [Homebrew](https://brew.sh/):

Expand Down Expand Up @@ -90,3 +90,7 @@ Downloading the dictionary...

cmdict is ready to use!
```

## How to contribute

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=master&repo=266903250&machine=largePremiumLinux&location=WestEurope)

1 comment on commit 48c7c29

@jiedxu
Copy link
Collaborator Author

@jiedxu jiedxu commented on 48c7c29 Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit message is not correct. Poetry is indeed installed in the devcontainer.

Please sign in to comment.