Skip to content

Commit

Permalink
Merge pull request #3 from Y0sh1dk/feature/ci-testing-action-test
Browse files Browse the repository at this point in the history
Test automated testing
  • Loading branch information
Y0sh1dk authored Dec 16, 2023
2 parents ecbbb05 + 740cbac commit 9d703f9
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: GHA Docker Image Exists
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@feature/logging
uses: Y0sh1dk/gha-docker-image-exists@feature/ci-testing-action-test
with:
image: nginx:latest

Expand All @@ -28,7 +28,7 @@ jobs:
- name: GHA Docker Image Exists
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@feature/logging
uses: Y0sh1dk/gha-docker-image-exists@feature/ci-testing-action-test
with:
image: nginx:invalid-tag

Expand Down
35 changes: 22 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

on:
push:
branches:
Expand Down Expand Up @@ -43,11 +47,11 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: Update compiled binaries
commit_message: "[skip ci] Update compiled binaries"
file_pattern: "bin/*"

gen-tests:
needs: [lint, build]
test:
needs: [lint]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -60,6 +64,11 @@ jobs:
- name: Install Task
uses: arduino/setup-task@v1

- name: Generate test branch name
id: generate_branch
run: |
echo "branch=test/${{ github.head_ref }}/$(git rev-parse --short HEAD)/${{ github.run_id }}" >> $GITHUB_OUTPUT
- name: Generate tests
run: |
ACTION_VERSION=${{ github.head_ref }} task gen-tests
Expand All @@ -68,21 +77,21 @@ jobs:
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update tests"
file_pattern: ".github/workflows/test.yaml"
file_pattern: ".github/workflows/autogen-test.yaml"
branch: ${{ steps.generate_branch.outputs.branch }}
create_branch: true

trigger-tests:
needs: [gen-tests]
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Trigger generated tests
uses: convictional/[email protected]
with:
owner: Y0sh1dk
repo: gha-docker-image-exists
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow_file_name: test.yml
ref: ${{ github.head_ref}}
workflow_file_name: autogen-test.yml
ref: ${{ steps.generate_branch.outputs.branch }}
wait_workflow: true

- name: Delete branch
run: |
echo "Deleting branch ${{ steps.generate_branch.outputs.branch }}..."
git push origin --delete ${{ steps.generate_branch.outputs.branch }}
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ tasks:
vars:
WORKFLOW_NAME: "{{ .GIT_REPO_NAME }}"
ACTION_VERSION: "{{ .ACTION_VERSION }}"
COMMAND: -f .github/workflows/test.yaml.tmpl --left-delim "[[[" --right-delim "]]]" > .github/workflows/test.yaml
COMMAND: -f .github/workflows/test.yaml.tmpl --left-delim "[[[" --right-delim "]]]" > .github/workflows/autogen-test.yaml

build-all:
desc: Build the application for all platforms
Expand Down
Binary file modified bin/gha-docker-image-exists-darwin-amd64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-darwin-arm64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-linux-amd64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-linux-arm64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-windows-amd64
Binary file not shown.
Binary file modified bin/gha-docker-image-exists-windows-arm64
Binary file not shown.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
client.Close()

if imageExists {
fmt.Println("Image exists")
fmt.Printf("Image %s exists\n", config.image)
os.Exit(0)
}

Expand Down

0 comments on commit 9d703f9

Please sign in to comment.