diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1bd8431..e5c8fe6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,6 +12,7 @@ on: jobs: lint: + name: Lint runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -29,6 +30,7 @@ jobs: task lint build: + name: Build needs: [lint] runs-on: ubuntu-latest permissions: @@ -51,7 +53,8 @@ jobs: file_pattern: "bin/*" test: - needs: [lint] + name: Test + needs: [lint, build] runs-on: ubuntu-latest permissions: contents: write @@ -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" @@ -82,16 +86,18 @@ jobs: create_branch: true - name: Trigger generated tests - uses: convictional/trigger-workflow-and-wait@v1.6.1 + uses: convictional/trigger-workflow-and-wait@v1.6.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 }} diff --git a/.github/workflows/test.yaml.tmpl b/.github/workflows/test.yaml.tmpl index c18396b..3e8107b 100644 --- a/.github/workflows/test.yaml.tmpl +++ b/.github/workflows/test.yaml.tmpl @@ -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 ]]] @@ -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 ]]] diff --git a/.task/checksum/build b/.task/checksum/build new file mode 100644 index 0000000..d306fd2 --- /dev/null +++ b/.task/checksum/build @@ -0,0 +1 @@ +90d25729e1f7ca52ae1ce10d633ebc69 diff --git a/Taskfile.yaml b/Taskfile.yaml index 6f32073..e315173 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -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 diff --git a/bin/gha-docker-image-exists-darwin-amd64 b/bin/gha-docker-image-exists-darwin-amd64 index 41ba0f9..9a30502 100755 Binary files a/bin/gha-docker-image-exists-darwin-amd64 and b/bin/gha-docker-image-exists-darwin-amd64 differ diff --git a/bin/gha-docker-image-exists-darwin-arm64 b/bin/gha-docker-image-exists-darwin-arm64 index 10683d4..1cd904d 100755 Binary files a/bin/gha-docker-image-exists-darwin-arm64 and b/bin/gha-docker-image-exists-darwin-arm64 differ diff --git a/bin/gha-docker-image-exists-linux-amd64 b/bin/gha-docker-image-exists-linux-amd64 index 34780c1..106f32b 100755 Binary files a/bin/gha-docker-image-exists-linux-amd64 and b/bin/gha-docker-image-exists-linux-amd64 differ diff --git a/bin/gha-docker-image-exists-linux-arm64 b/bin/gha-docker-image-exists-linux-arm64 index 43c5a2e..e9e23f0 100755 Binary files a/bin/gha-docker-image-exists-linux-arm64 and b/bin/gha-docker-image-exists-linux-arm64 differ diff --git a/bin/gha-docker-image-exists-windows-amd64 b/bin/gha-docker-image-exists-windows-amd64 index 7b3fb96..d7a3a0a 100755 Binary files a/bin/gha-docker-image-exists-windows-amd64 and b/bin/gha-docker-image-exists-windows-amd64 differ diff --git a/bin/gha-docker-image-exists-windows-arm64 b/bin/gha-docker-image-exists-windows-arm64 index af7a412..e31e620 100755 Binary files a/bin/gha-docker-image-exists-windows-arm64 and b/bin/gha-docker-image-exists-windows-arm64 differ diff --git a/go.mod b/go.mod index f9a92a0..6af42e6 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index d722a95..fb64003 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= @@ -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= @@ -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=