Skip to content

Commit

Permalink
Merge deee3b9 into 7d3f65f
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0sh1dk authored Dec 17, 2023
2 parents 7d3f65f + deee3b9 commit d566510
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update tests"
file_pattern: ".github/workflows/autogen-test.yaml"
file_pattern: ".github/workflows/test.yaml"
branch: ${{ steps.generate_branch.outputs.branch }}
create_branch: true

Expand All @@ -91,7 +91,7 @@ jobs:
owner: Y0sh1dk
repo: gha-docker-image-exists
github_token: ${{ secrets.GHA_TOKEN }}
workflow_file_name: autogen-test.yaml
workflow_file_name: test.yaml
ref: ${{ steps.generate_branch.outputs.branch }}
wait_workflow: true
comment_downstream_url: ${{ github.event.pull_request.comments_url }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
name: gha-docker-image-exists Test

on:
workflow_dispatch:

jobs:
success:
runs-on: ubuntu-latest
steps:
- name: GHA Docker Image Exists
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@feature/ci-testing-action-test
uses: Y0sh1dk/gha-docker-image-exists@main
with:
image: nginx:latest

- name: Check output
run: |
if [ ${{ steps.gha-docker-image-exists.outcome == 'success' }} ]; then
exit 0
else
exit 1
fi
fail:
runs-on: ubuntu-latest
steps:
- name: GHA Docker Image Exists
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@feature/ci-testing-action-test
uses: Y0sh1dk/gha-docker-image-exists@main
with:
image: nginx:invalid-tag

- name: Check output
run: |
if [ ${{ steps.gha-docker-image-exists.outcome == 'failure' }} ]; then
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/test.yaml.tmpl

This file was deleted.

26 changes: 21 additions & 5 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ vars:
GO_MOD_CACHE_VOLUME: go-module-cache
GIT_REPO_NAME:
sh: basename $(git rev-parse --show-toplevel)
GIT_REPO_OWNER: Y0sh1dk
GIT_REPO_FULL: "{{ .GIT_REPO_OWNER }}/{{ .GIT_REPO_NAME }}"

tasks:
create-go-mod-cache-volume:
Expand Down Expand Up @@ -46,6 +48,20 @@ tasks:
hairyhenderson/gomplate:stable \
{{ .COMMAND }}
_yq-docker: &yq-docker
internal: true
cmds:
- |
docker run \
--rm \
-e WORKFLOW_NAME={{ .WORKFLOW_NAME }} \
-e ACTION_VERSION={{ .ACTION_VERSION }} \
-v $(pwd):/app \
--user="root" \
-w /app \
mikefarah/yq:latest \
{{ .COMMAND }}
build:
<<: *go-docker
internal: false
Expand All @@ -62,20 +78,20 @@ tasks:
COMMAND: go build -ldflags="-w -s" -o bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }} *.go {{ .CLI_ARGS }}

gen-tests:
<<: *gomplate-docker
<<: *yq-docker
internal: false
desc: Generate test workflows
requires:
vars: [ACTION_VERSION]
vars:
WORKFLOW_NAME: "{{ .GIT_REPO_NAME }}"
ACTION_VERSION: "{{ .ACTION_VERSION }}"
COMMAND: -f .github/workflows/test.yaml.tmpl --left-delim "[[[" --right-delim "]]]" > .github/workflows/autogen-test.yaml
ACTION_VERSION: "{{ .GIT_REPO_FULL}}@{{ .ACTION_VERSION }}"
COMMAND: |
-i '.jobs.[].steps[] |= (select(has("uses") and .uses == "{{ .GIT_REPO_FULL }}@*") | .uses = env(ACTION_VERSION))' .github/workflows/test.yaml
build-all:
desc: Build the application for all platforms
vars:
ALL_OS: linux darwin windows
ALL_OS: linux darwin
ALL_ARCH: amd64 arm64
cmds:
- |
Expand Down
Binary file modified bin/gha-docker-image-exists-darwin-amd64
Binary file not shown.
12 changes: 6 additions & 6 deletions shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ function chooseBinary() {
if (platform === 'linux' && arch === 'arm64') {
return `gha-docker-image-exists-linux-arm64`
}
if (platform === 'windows' && arch === 'x64') {
return `gha-docker-image-exists-windows-amd64`
}
if (platform === 'windows' && arch === 'arm64') {
return `gha-docker-image-exists-windows-arm64`
}
// if (platform === 'win32' && arch === 'x64') {
// return `gha-docker-image-exists-windows-amd64`
// }
// if (platform === 'win32' && arch === 'arm64') {
// return `gha-docker-image-exists-windows-arm64`
// }
if (platform === 'darwin' && arch === 'x64') {
return `gha-docker-image-exists-darwin-amd64`
}
Expand Down

0 comments on commit d566510

Please sign in to comment.