-
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
1 parent
4a0b18f
commit 617ab76
Showing
7 changed files
with
330 additions
and
163 deletions.
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,20 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: [dagger] | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
- name: Install Dagger CLI | ||
run: cd /usr/local && { curl -L https://dl.dagger.io/dagger/install.sh | sh; cd -; } | ||
- name: Install Dagger SDK | ||
run: pip install dagger-io | ||
- name: Run Dagger pipeline | ||
run: dagger run python CI.py |
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,46 @@ | ||
import sys | ||
|
||
import anyio | ||
import dagger | ||
|
||
|
||
async def test(): | ||
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client: | ||
source = client.host().directory( | ||
".", exclude=[".git", "node_modules", ".venv", "__ci__.py"] | ||
) | ||
redis = client.container().from_("redis:7").with_exposed_port(6379).as_service() | ||
|
||
python = ( | ||
client.container() | ||
.from_("python:3.12-slim") | ||
.with_mounted_cache( | ||
"/root/.cache", client.cache_volume("pycrdt-example-app-cache") | ||
) | ||
.with_service_binding("redis", redis) | ||
.with_exec( | ||
[ | ||
"/bin/sh", | ||
"-c", | ||
"apt-get update && apt-get install --no-install-recommends -y build-essential", | ||
] | ||
) | ||
.with_exec(["pip", "install", "poetry"]) | ||
.with_workdir("/src") | ||
.with_file("/src/poetry.lock", client.host().file("poetry.lock")) | ||
.with_file("/src/pyproject.toml", client.host().file("pyproject.toml")) | ||
.with_exec(["poetry", "install", "--only", "playwright"]) | ||
.with_exec(["poetry", "run", "playwright", "install-deps"]) | ||
.with_exec(["poetry", "run", "playwright", "install", "chromium"]) | ||
.with_directory("/src", source) | ||
.with_exec(["poetry", "install", "--without", "playwright"]) | ||
.with_exec(["poetry", "run", "pytest"]) | ||
) | ||
|
||
# execute | ||
await python.sync() | ||
|
||
print("Tests succeeded!") | ||
|
||
|
||
anyio.run(test) |
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
Oops, something went wrong.