Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
name: "Release dev container features & Generate Documentation"
name: "Devcontainer publish"
on:
workflow_run:
workflows: ["Devcontainer test"]
types: [completed]
branches: ["main"]
workflow_dispatch:

jobs:
check-test:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' }}
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- id: check
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event.workflow_run.conclusion }}" = "success" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "Test workflow did not succeed. Skipping release."
echo "should_run=false" >> $GITHUB_OUTPUT
fi

deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: check-test
if: needs.check-test.outputs.should_run == 'true' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
Comment on lines 27 to 30
permissions:
contents: write
Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
name: "CI - Test Features"
name: "Devcontainer test"
on:
push:
branches:
- main
pull_request:
workflow_run:
workflows: ["Devcontainer validate"]
types: [completed]
workflow_dispatch:
Comment on lines +1 to 6

jobs:
check-validate:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch' }}
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- id: check
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
elif [ "${{ github.event.workflow_run.event }}" = "pull_request" ]; then
if [ "${{ github.event.workflow_run.conclusion }}" = "success" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "Validate workflow did not succeed. Skipping tests."
echo "should_run=false" >> $GITHUB_OUTPUT
fi
elif [ "${{ github.event.workflow_run.head_branch }}" = "main" ]; then
if [ "${{ github.event.workflow_run.conclusion }}" = "success" ]; then
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "Validate workflow did not succeed. Skipping tests."
echo "should_run=false" >> $GITHUB_OUTPUT
fi
else
echo "Not a PR or main branch push. Skipping tests."
echo "should_run=false" >> $GITHUB_OUTPUT
fi

test-autogenerated:
needs: check-validate
if: needs.check-validate.outputs.should_run == 'true'
runs-on: ubuntu-latest
Comment on lines 38 to 41
continue-on-error: true
strategy:
Expand All @@ -29,6 +59,8 @@ jobs:
run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} .

test-scenarios:
needs: check-validate
if: needs.check-validate.outputs.should_run == 'true'
runs-on: ubuntu-latest
continue-on-error: true
strategy:
Expand All @@ -45,6 +77,8 @@ jobs:
run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated --skip-duplicated .

test-global:
needs: check-validate
if: needs.check-validate.outputs.should_run == 'true'
runs-on: ubuntu-latest
continue-on-error: true
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Validate devcontainer-feature.json files"
name: "Devcontainer validate"
on:
workflow_dispatch:
push:
pull_request:

jobs:
Expand Down
Loading