-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.85 KB
/
Copy pathtest.yaml
File metadata and controls
54 lines (44 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Smoke tests
on:
push:
branches: ["**"]
pull_request:
branches: ["master"]
workflow_dispatch:
jobs:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t ansible-cli-smoke:test .
- name: smoke_build — image built
run: docker image inspect ansible-cli-smoke:test > /dev/null
- name: smoke_ansible — CLI version checks
run: |
docker run --rm ansible-cli-smoke:test "ansible --version"
docker run --rm ansible-cli-smoke:test "ansible-playbook --version"
docker run --rm ansible-cli-smoke:test "ansible-inventory --help"
- name: smoke_python — dependency imports
run: |
docker run --rm ansible-cli-smoke:test "python -c 'import winrm; print(\"winrm ok\")'"
docker run --rm ansible-cli-smoke:test "python -c 'import ansible; print(\"ansible ok\")'"
- name: smoke_shell — eval passthrough
run: |
OUTPUT=$(docker run --rm ansible-cli-smoke:test "echo hello from ansible")
[ "$OUTPUT" = "hello from ansible" ] || { echo "FAIL: $OUTPUT"; exit 1; }
- name: smoke_shell — exit code propagation
run: |
set +e
docker run --rm ansible-cli-smoke:test "exit 42"
RC=$?
set -e
[ "$RC" -eq 42 ] || { echo "FAIL: expected 42, got $RC"; exit 1; }
- name: smoke_playbook — syntax check
run: |
docker run --rm -v ${{ github.workspace }}/tests:/tests:ro ansible-cli-smoke:test \
"ansible-playbook --syntax-check /tests/test.yml"
- name: smoke_playbook — ping localhost
run: |
docker run --rm -v ${{ github.workspace }}/tests:/tests:ro ansible-cli-smoke:test \
"ansible-playbook -i 'localhost,' -c local /tests/test.yml"