Skip to content

Commit

Permalink
Merge pull request #4 from Y0sh1dk/feature/ci-testing-action-test-2
Browse files Browse the repository at this point in the history
CI testing
  • Loading branch information
Y0sh1dk authored Dec 16, 2023
2 parents 9d703f9 + a6b28c1 commit 7d3f65f
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 17 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand All @@ -29,6 +30,7 @@ jobs:
task lint
build:
name: Build
needs: [lint]
runs-on: ubuntu-latest
permissions:
Expand All @@ -51,7 +53,8 @@ jobs:
file_pattern: "bin/*"

test:
needs: [lint]
name: Test
needs: [lint, build]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -67,13 +70,14 @@ jobs:
- 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
echo "branch=test/${{ github.head_ref }}/$(git rev-parse --short HEAD)/${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Generate tests
run: |
ACTION_VERSION=${{ github.head_ref }} task gen-tests
- uses: stefanzweifel/git-auto-commit-action@v5
- name: Commit generated tests
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: "[skip ci] Update tests"
Expand All @@ -82,16 +86,18 @@ jobs:
create_branch: true

- name: Trigger generated tests
uses: convictional/[email protected].1
uses: convictional/[email protected].5
with:
owner: Y0sh1dk
repo: gha-docker-image-exists
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow_file_name: autogen-test.yml
github_token: ${{ secrets.GHA_TOKEN }}
workflow_file_name: autogen-test.yaml
ref: ${{ steps.generate_branch.outputs.branch }}
wait_workflow: true
comment_downstream_url: ${{ github.event.pull_request.comments_url }}

- name: Delete branch
if: always()
run: |
echo "Deleting branch ${{ steps.generate_branch.outputs.branch }}..."
git push origin --delete ${{ steps.generate_branch.outputs.branch }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
success:
runs-on: ubuntu-latest
steps:
- name: GHA Docker Image Exists
- name: [[[ .Env.WORKFLOW_NAME ]]] valid tag
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@[[[ .Env.ACTION_VERSION ]]]
Expand All @@ -25,7 +25,7 @@ jobs:
fail:
runs-on: ubuntu-latest
steps:
- name: GHA Docker Image Exists
- name: [[[ .Env.WORKFLOW_NAME ]]] invalid tag
id: gha-docker-image-exists
continue-on-error: true
uses: Y0sh1dk/gha-docker-image-exists@[[[ .Env.ACTION_VERSION ]]]
Expand Down
1 change: 1 addition & 0 deletions .task/checksum/build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90d25729e1f7ca52ae1ce10d633ebc69
13 changes: 9 additions & 4 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ tasks:
<<: *go-docker
internal: false
desc: Build the application
env:
GOOS: "{{OS}}"
GOARCH: "{{ARCH}}"
sources:
- "*.go"
- "go.mod"
- "go.sum"
generates:
- "bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }}"
vars:
COMMAND: go build -o bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }} *.go {{ .CLI_ARGS }}
GOOS: "{{ .GOOS | default OS }}"
GOARCH: "{{ .GOARCH | default ARCH}}"
COMMAND: go build -ldflags="-w -s" -o bin/{{ .GIT_REPO_NAME }}-{{ .GOOS }}-{{ .GOARCH }} *.go {{ .CLI_ARGS }}

gen-tests:
<<: *gomplate-docker
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.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sethvargo/go-envconfig v0.8.0 // indirect
github.com/sethvargo/go-envconfig v0.9.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/tools v0.16.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sethvargo/go-envconfig v0.8.0 h1:AcmdAewSFAc7pQ1Ghz+vhZkilUtxX559QlDuLLiSkdI=
github.com/sethvargo/go-envconfig v0.8.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-envconfig v0.9.0 h1:Q6FQ6hVEeTECULvkJZakq3dZMeBQ3JUpcKMfPQbKMDE=
github.com/sethvargo/go-envconfig v0.9.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-githubactions v1.1.0 h1:mg03w+b+/s5SMS298/2G6tHv8P0w0VhUFaqL1THIqzY=
github.com/sethvargo/go-githubactions v1.1.0/go.mod h1:qIboSF7yq2Qnaw2WXDsqCReM0Lo1gU4QXUWmhBC3pxE=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand All @@ -47,12 +49,16 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -63,6 +69,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
Expand All @@ -73,6 +81,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down

0 comments on commit 7d3f65f

Please sign in to comment.