diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 39519ad..60ee021 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,11 +1,11 @@ name: test on: push: - branches: [dagger] + branches: [main] jobs: build: - name: build + name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/CI.py b/CI.py index 426f692..9c8ca48 100644 --- a/CI.py +++ b/CI.py @@ -6,9 +6,25 @@ async def test(): async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client: - source = client.host().directory( + source_code = client.host().directory( ".", exclude=[".git", "node_modules", ".venv", "__ci__.py"] ) + + javascript = ( + client.container() + .from_("node:16.15.0-slim") + .with_workdir("/src") + .with_file("/src/package.json", client.host().file("package.json")) + .with_file( + "/src/package-lock.json", client.host().file("package-lock.json") + ) + .with_exec(["npm", "install"]) + .with_directory("/src", source_code) + .with_exec(["npx", "webpack", "--mode", "production"]) + ) + + await javascript.sync() + redis = client.container().from_("redis:7").with_exposed_port(6379).as_service() python = ( @@ -32,7 +48,11 @@ async def test(): .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_directory("/src", source_code) + .with_directory( + "/src/example_app/static/bundles", + javascript.directory("/src/example_app/static/bundles"), + ) .with_exec(["poetry", "install", "--without", "playwright"]) .with_exec(["poetry", "run", "pytest"]) )