Bird
Raised Fist0
Denoframework~10 mins

CI/CD pipeline setup in Deno - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a step that checks out the repository in a GitHub Actions workflow.

Deno
steps:
  - name: Checkout code
    uses: [1]
Drag options to blanks, or click blank then click option'
Aactions/setup-deno@v1
Bdenoland/setup-deno@v1
Cactions/checkout@v3
Dactions/upload-artifact@v2
Attempts:
3 left
💡 Hint
Common Mistakes
Using setup-deno instead of checkout for code retrieval.
Using upload-artifact which is for uploading files, not checking out code.
2fill in blank
medium

Complete the code to set up Deno in the GitHub Actions workflow.

Deno
steps:
  - name: Setup Deno
    uses: [1]
Drag options to blanks, or click blank then click option'
Aactions/cache@v3
Bdenoland/setup-deno@v1
Cactions/setup-node@v3
Dactions/checkout@v3
Attempts:
3 left
💡 Hint
Common Mistakes
Using setup-node which is for Node.js, not Deno.
Using checkout which only retrieves code.
3fill in blank
hard

Fix the error in the command to run tests with Deno in the workflow.

Deno
run: deno [1] --unstable --allow-net
Drag options to blanks, or click blank then click option'
Atest
Binstall
Ccheck
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' which executes scripts but does not run tests.
Using 'check' which only checks types.
Using 'install' which installs scripts.
4fill in blank
hard

Fill both blanks to cache Deno dependencies and restore them in the workflow.

Deno
steps:
  - name: Cache Deno modules
    uses: actions/cache@v3
    with:
      path: ~/.cache/deno
      key: ${{ runner.os }}-deno-[1]
      restore-keys: |
        ${{ runner.os }}-deno-[2]
Drag options to blanks, or click blank then click option'
Alockfile-hash
Bdeno-version
Attempts:
3 left
💡 Hint
Common Mistakes
Using deno-version which does not change when dependencies change.
Using unrelated keys that do not reflect dependency state.
5fill in blank
hard

Fill all three blanks to create a job that runs tests on push events using Deno.

Deno
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: [1]
      - uses: [2]
      - name: Run tests
        run: deno [3] --unstable --allow-net
Drag options to blanks, or click blank then click option'
Aactions/checkout@v3
Bdenoland/setup-deno@v1
Ctest
Dactions/cache@v3
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of steps.
Using wrong actions for checkout or setup.
Using 'run' instead of 'test' for Deno test command.

Practice

(1/5)
1. What is the main purpose of setting up a CI/CD pipeline for a Deno project?
easy
A. To automate testing and deployment processes
B. To write code faster manually
C. To increase the size of the project files
D. To disable automatic updates

Solution

  1. Step 1: Understand CI/CD pipeline purpose

    A CI/CD pipeline automates repetitive tasks like testing and deployment to save time and reduce errors.
  2. Step 2: Match purpose to options

    Only To automate testing and deployment processes describes automation of testing and deployment, which is the main goal.
  3. Final Answer:

    To automate testing and deployment processes -> Option A
  4. Quick Check:

    CI/CD automates testing and deployment = A [OK]
Hint: CI/CD means automating build, test, and deploy steps [OK]
Common Mistakes:
  • Thinking CI/CD is about writing code manually
  • Confusing CI/CD with increasing file size
  • Believing CI/CD disables updates
2. Which of the following is the correct command to run tests in a Deno CI/CD pipeline?
easy
A. deno test
B. deno run test
C. deno build test
D. deno deploy test

Solution

  1. Step 1: Recall Deno test command

    The official command to run tests in Deno is deno test.
  2. Step 2: Compare options with correct syntax

    Only deno test matches the correct command syntax for running tests.
  3. Final Answer:

    deno test -> Option A
  4. Quick Check:

    Run tests with 'deno test' = A [OK]
Hint: Use 'deno test' to run tests, not 'deno run test' [OK]
Common Mistakes:
  • Using 'deno run test' which runs a script, not tests
  • Confusing build or deploy commands with test command
  • Adding extra words like 'build' or 'deploy' incorrectly
3. Given this CI step in a Deno pipeline:
steps:
  - name: Run tests
    run: deno test --unstable
  - name: Bundle code
    run: deno bundle mod.ts bundle.js

What will be the result if tests fail?
medium
A. The pipeline skips tests and bundles code
B. The pipeline stops and does not bundle the code
C. The pipeline continues and bundles the code anyway
D. The pipeline deletes the bundle.js file

Solution

  1. Step 1: Understand default pipeline behavior on failure

    In most CI/CD systems, if a test step fails, the pipeline stops to prevent deploying broken code.
  2. Step 2: Apply to given steps

    If deno test --unstable fails, the next step to bundle code will not run.
  3. Final Answer:

    The pipeline stops and does not bundle the code -> Option B
  4. Quick Check:

    Failed tests stop pipeline = C [OK]
Hint: Failed tests usually stop pipeline to avoid bad deploys [OK]
Common Mistakes:
  • Assuming pipeline continues after test failure
  • Thinking tests are skipped automatically
  • Believing files get deleted on test failure
4. You wrote this pipeline step:
steps:
  - name: Bundle code
    run: deno bundle mod.ts -o bundle.js

But the pipeline fails with an error. What is the likely cause?
medium
A. The pipeline requires 'deno test' before bundling
B. The file 'mod.ts' does not exist
C. The 'run' keyword is misspelled
D. The '-o' flag is not valid for 'deno bundle'

Solution

  1. Step 1: Check 'deno bundle' syntax

    The correct syntax to specify output file is: deno bundle input.ts output.js without '-o' flag.
  2. Step 2: Identify error cause

    Using '-o' causes an error because 'deno bundle' does not support it.
  3. Final Answer:

    The '-o' flag is not valid for 'deno bundle' -> Option D
  4. Quick Check:

    Output file is positional, no '-o' flag = D [OK]
Hint: Use positional output filename, not '-o', with deno bundle [OK]
Common Mistakes:
  • Adding '-o' flag like other bundlers
  • Assuming file existence without checking
  • Thinking 'run' keyword is wrong
  • Believing tests must run before bundling always
5. You want to create a CI/CD pipeline that runs tests, bundles code, and then deploys only if tests pass. Which YAML snippet correctly represents this sequence?
hard
A. steps: - run: deno bundle mod.ts bundle.js - run: deno test - run: deploy.sh
B. steps: - run: deploy.sh - run: deno test - run: deno bundle mod.ts bundle.js
C. steps: - run: deno test - run: deno bundle mod.ts bundle.js - run: deploy.sh
D. steps: - run: deno test - run: deploy.sh - run: deno bundle mod.ts bundle.js

Solution

  1. Step 1: Determine correct order for CI/CD steps

    Tests must run first to verify code, then bundle code, then deploy if tests pass.
  2. Step 2: Match order with options

    Only steps: - run: deno test - run: deno bundle mod.ts bundle.js - run: deploy.sh runs tests first, then bundles, then deploys.
  3. Final Answer:

    Tests first, then bundle, then deploy -> Option C
  4. Quick Check:

    Test -> Bundle -> Deploy = B [OK]
Hint: Test first, then bundle, then deploy in pipeline steps [OK]
Common Mistakes:
  • Deploying before tests run
  • Bundling before tests
  • Changing step order incorrectly
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard