RustBrock/.gitea/workflows/testing.yaml
darkicewolf50 f3ec0d98cc
Some checks failed
Test Gitea Actions / first (push) Successful in 12s
Test Gitea Actions / check-code (push) Failing after 21s
Test Gitea Actions / test (push) Has been skipped
Test Gitea Actions / documentation-check (push) Has been skipped
finsihed ch14.1 and more than halfway through ch14.2
2025-02-25 17:02:50 -07:00

127 lines
3.7 KiB
YAML

# name of the workflow.
# this is optional.
name: Test Gitea Actions
# events that will trigger this workflow.
# here, we only have "pull_request", so the workflow will run
# whenever we create a pull request.
# other examples: [push] and [pull_request, push]
on: [push]
env:
CARGO_TERM_COLOR: always
# each workflow must have at least one job.
# jobs run in parallel by default (we can change that).
# each job groups together a series of steps to accomplish a purpose.
jobs:
# name of the job
first:
# the platform or OS that the workflow will run on.
runs-on: ubuntu-latest
# series of steps to finish the job.
steps:
# name of the step.
# steps run sequentially.
# this is optionale
- name: checkout
# each step can either have "uses" or "run".
# "uses" run an action written somewhere other than this workflow .
# usually from the community.
# this action checks out the repo code to the runner (instance)
# running the action
uses: actions/checkout@v3
# another step.
# this step runs a bash (Ubuntu's default shell) command
- name: list files
run: ls
# name of the job
check-code:
# the platform or OS that the workflow will run on.
runs-on: ubuntu-latest
# series of steps to finish the job.
steps:
# name of the step.
# steps run sequentially.
# this is optionale
- name: checkout
# each step can either have "uses" or "run".
# "uses" run an action written somewhere other than this workflow .
# usually from the community.
# this action checks out the repo code to the runner (instance)
# running the action
uses: actions/checkout@v4
- name: move to minigrep
run: cd minigrep/
# another step.
# Step 1: Run cargo check and fail if it fails
- name: Check
run: cargo check --verbose
# name of the job
test:
# the platform or OS that the workflow will run on.
runs-on: ubuntu-latest
# Ensures this job runs only if check-code succeeds
needs: check-code
# series of steps to finish the job.
steps:
# name of the step.
# steps run sequentially.
# this is optionale
- name: checkout
# each step can either have "uses" or "run".
# "uses" run an action written somewhere other than this workflow .
# usually from the community.
# this action checks out the repo code to the runner (instance)
# running the action
uses: actions/checkout@v4
- name: move to minigrep
run: cd minigrep/
# Step 2: Run unit and integration tests (excluding documentation tests)
- name: Run Tests
run: cargo test --tests --verbose
# name of the job
documentation-check:
# the platform or OS that the workflow will run on.
runs-on: ubuntu-latest
# Ensures this job runs only if check-code succeeds
needs: check-code
# series of steps to finish the job.
steps:
# name of the step.
# steps run sequentially.
# this is optionale
- name: checkout
# each step can either have "uses" or "run".
# "uses" run an action written somewhere other than this workflow .
# usually from the community.
# this action checks out the repo code to the runner (instance)
# running the action
uses: actions/checkout@v4
- name: move to minigrep
run: cd minigrep/
# Step 3: Check if documentation tests were run
- name: Check for Documentation Tests
run: |
DOC_TESTS=$(cargo test --doc --verbose)
if [[ ! "$DOC_TESTS" =~ "running" ]]; then
echo "No documentation tests were run!" && exit 1
fi