-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Don Murray
committed
Jul 11, 2024
1 parent
2af7d81
commit 0471a23
Showing
11 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
{ | ||
"build": { | ||
"dockerfile": "../Dockerfile" | ||
}, | ||
"name": "Python 3.12", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "./install-dependencies.sh" | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
//"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm" | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "pip3 install --user -r requirements.txt", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
lint-and-unit: | ||
runs-on: ubuntu-latest | ||
container: mcr.microsoft.com/devcontainers/python:1-3.12-bookworm | ||
steps: | ||
- name: "Install dependencies" | ||
run: ./install-dependencies.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,3 +163,6 @@ cython_debug/ | |
|
||
# Secrets | ||
*.env | ||
|
||
# taskfile.dev cache | ||
.task/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pytest = "*" | ||
flake8 = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.12" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
# python-vscode-devcontainer | ||
A template for developing Python with VS Code in a Devcontainer | ||
|
||
A template for developing Python with VS Code in a Devcontainer. Since [Hacken](https://hacken.ca) mostly uses Bitbucket Pipelines, that is supported as well as GitHub Actions. | ||
|
||
Provides a development environment with: | ||
- Python 3.12 | ||
- pipenv | ||
- pytest | ||
- flake8 | ||
- [Task](https://taskfile.dev) | ||
|
||
|
||
Usage: | ||
- `task flake8` | ||
- `task test` | ||
- `task watch` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
image: python:3.12 | ||
options: | ||
max-time: 1 | ||
pipelines: | ||
default: | ||
- step: | ||
name: "Build and Test" | ||
caches: | ||
- pip | ||
script: | ||
- wget https://github.com/go-task/task/releases/download/v3.37.2/task_linux_amd64.deb | ||
- dpkg -i task_linux_amd64.deb | ||
- task --version | ||
- pip install pipenv | ||
- pipenv install --ignore-pipfile | ||
- pipenv run task | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Is task already installed? | ||
which task | ||
rc=$? | ||
|
||
set -e | ||
if [ 0 -ne $rc ]; then | ||
deb='task_linux_amd64.deb' | ||
wget https://github.com/go-task/task/releases/download/v3.37.2/${deb} | ||
sudo dpkg -i ${deb} | ||
rm -f ${deb} | ||
fi | ||
|
||
pipenv install --ignore-pipfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# https://taskfile.dev | ||
|
||
version: '3.37' | ||
|
||
interval: '100ms' | ||
|
||
vars: | ||
|
||
tasks: | ||
default: | ||
desc: "Lint check and unit test" | ||
deps: [flake8, test] | ||
|
||
watch: | ||
desc: "Watch flake8 and unit tests" | ||
deps: [flake8, test] | ||
watch: true | ||
sources: | ||
- '**/*.py' | ||
- '*.yml' | ||
|
||
flake8: | ||
aliases: [lint] | ||
desc: "Lint check" | ||
watch: true | ||
cmds: | ||
- flake8 | ||
|
||
test: | ||
desc: "Unit tests" | ||
watch: true | ||
cmds: | ||
- pytest | ||
|
||
kick: | ||
desc: Kick the CICD pipeline. | ||
vars: | ||
KICK: "$(pwd)/.kick-pipeline" | ||
cmds: | ||
- | | ||
date > {{.KICK}} | ||
git add {{.KICK}} | ||
git ci -m "kick" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_will_pass(): | ||
assert True |