mirror of
https://github.com/dagger/dagger-for-github.git
synced 2026-01-07 22:50:00 +11:00
187 lines
4.6 KiB
YAML
187 lines
4.6 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
# Enable manual trigger for easy debugging
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
output:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: "Use output"
|
|
id: use-output
|
|
uses: ./
|
|
with:
|
|
version: latest
|
|
verb: core
|
|
args: container from --address=alpine with-exec --args echo,-n,"hello world" stdout
|
|
- name: "Use output (check)"
|
|
run: |
|
|
target='${{ steps.use-output.outputs.output }}'
|
|
if [[ "$target" == "hello world" ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Use trailing output"
|
|
id: use-trailing-output
|
|
uses: ./
|
|
with:
|
|
version: latest
|
|
verb: core
|
|
args: container from --address=alpine with-exec --args echo,-n,-e,"hello world\n" stdout
|
|
- name: "Use output (check)"
|
|
run: |
|
|
target='${{ steps.use-trailing-output.outputs.output }}'
|
|
result='hello world
|
|
'
|
|
if [[ "$target" == "$result" ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Use multiline output"
|
|
id: use-multiline-output
|
|
uses: ./
|
|
with:
|
|
version: latest
|
|
verb: core
|
|
args: container from --address=alpine with-exec --args echo,-n,-e,"hello\nworld" stdout
|
|
- name: "Use output (check)"
|
|
run: |
|
|
target='${{ steps.use-multiline-output.outputs.output }}'
|
|
result='hello
|
|
world'
|
|
if [[ "$target" == "$result" ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
version:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: "Use latest"
|
|
id: use-latest
|
|
uses: ./
|
|
with:
|
|
version: latest
|
|
verb: core
|
|
args: version
|
|
- name: "Use latest (check)"
|
|
run: |
|
|
target='${{ steps.use-latest.outputs.output }}'
|
|
if [[ "$target" =~ v[0-9]*\.[0-9]*\.[0-9]* ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Use v0.13.5"
|
|
id: use-v0-13-5
|
|
uses: ./
|
|
with:
|
|
version: v0.13.5
|
|
verb: core
|
|
args: version
|
|
- name: "Use v0.13.5 (check)"
|
|
run: |
|
|
target='${{ steps.use-v0-13-5.outputs.output }}'
|
|
if [[ "$target" =~ v0\.13\.5 ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Use commit"
|
|
id: use-commit
|
|
uses: ./
|
|
with:
|
|
commit: 540b4d1490f253054140f9249e823adf111e1c06
|
|
verb: core
|
|
args: version
|
|
- name: "Use commit (check)"
|
|
run: |
|
|
target='${{ steps.use-commit.outputs.output }}'
|
|
if [[ "$target" =~ v0\.13\.6-[0-9]+-540b4d1490f2 ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Use head"
|
|
id: use-head
|
|
uses: ./
|
|
with:
|
|
commit: head
|
|
verb: core
|
|
args: version
|
|
- name: "Use head (check)"
|
|
run: |
|
|
target='${{ steps.use-commit.outputs.output }}'
|
|
if [[ "$target" =~ v[0-9]*\.[0-9]*\.[0-9]*-[0-9]+-[0-9a-f]{12} ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
call:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: "Test call"
|
|
id: test-call
|
|
uses: ./
|
|
with:
|
|
module: github.com/shykes/daggerverse/hello@v0.3.0
|
|
call: hello
|
|
- name: "Test call (check)"
|
|
run: |
|
|
target='${{ steps.test-call.outputs.output }}'
|
|
if [[ "$target" == "hello, world!" ]]; then
|
|
echo "matches"
|
|
exit 0
|
|
else
|
|
echo "does not match"
|
|
exit 1
|
|
fi
|
|
nocall:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: "Only Install"
|
|
uses: ./
|
|
- name: "Test Install"
|
|
run: |
|
|
dagger core version
|