From 67e53c6ebfc3aa34b574ac87a826c703dc019736 Mon Sep 17 00:00:00 2001 From: Zach Peacock <1316813+thoom@users.noreply.github.com> Date: Tue, 8 Feb 2022 19:58:31 -0700 Subject: [PATCH 1/3] Fixing some build issues. --- .github/workflows/main.yml | 33 ++++++++++++++++++--------------- .github/workflows/test.yml | 35 +++++++++++++++++++---------------- scripts/build.sh | 10 +++++----- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94d0781..e7746ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,9 @@ jobs: if: "steps.tag.outputs.value != ''" env: RELEASE_VERSION: ${{ steps.tag.outputs.value }} + uses: actions/setup-go@v2 + with: + go-version: 1.17.x run: | ./scripts/build.sh @@ -72,9 +75,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./gulp-linux-386 - asset_name: gulp-linux-386 - asset_content_type: application/x-executable + asset_path: ./gulp.linux-386.tar.gz + asset_name: gulp.linux-386.tar.gz + asset_content_type: application/gzip - name: Upload Linux amd64 id: upload-release-l64 @@ -84,9 +87,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./gulp-linux-amd64 - asset_name: gulp-linux-amd64 - asset_content_type: application/x-executable + asset_path: ./gulp.linux-amd64.tar.gz + asset_name: gulp.linux-amd64.tar.gz + asset_content_type: application/gzip - name: Upload Darwin amd64 id: upload-release-d64 @@ -96,9 +99,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./gulp-darwin-amd64 - asset_name: gulp-darwin-amd64 - asset_content_type: application/x-mach-binary + asset_path: ./gulp.darwin-amd64.tar.gz + asset_name: gulp.darwin-amd64.tar.gz + asset_content_type: application/gzip - name: Upload Darwin arm64 id: upload-release-dArm64 @@ -108,9 +111,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./gulp-darwin-arm64 - asset_name: gulp-darwin-arm64 - asset_content_type: application/x-mach-binary + asset_path: ./gulp.darwin-arm64.tar.gz + asset_name: gulp.darwin-arm64.tar.gz + asset_content_type: application/gzip - name: Upload Windows id: upload-release-w @@ -120,6 +123,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./gulp-windows - asset_name: gulp-windows - asset_content_type: application/vnd.microsoft.portable-executable + asset_path: ./gulp.windows.zip + asset_name: gulp.windows.zip + asset_content_type: application/zip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e68085..683a3e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,19 +8,22 @@ jobs: os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@v2 - with: - # Disabling shallow clone is recommended for improving relevancy of reporting - fetch-depth: 0 - - name: Test - run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + + - name: Run Tests with Coverage + run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic + + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/scripts/build.sh b/scripts/build.sh index 0e6768d..cc4ab4d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,5 +1,5 @@ -env GOOS=linux GOARCH=386 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-linux386" -o gulp-linux-386 -env GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-linux64" -o gulp-linux-amd64 -env GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-darwin-amd64" -o gulp-darwin-amd64 -env GOOS=darwin GOARCH=arm64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-darwin-arm64" -o gulp-darwin-arm64 -env GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-windows" -o gulp-windows \ No newline at end of file +env GOOS=linux GOARCH=386 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-linux386" -o gulp && tar cfz gulp.linux-386.tar.gz gulp +env GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-linux64" -o gulp && tar cfz gulp.linux-amd64.tar.gz gulp +env GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-darwin-amd64" -o gulp && tar cfz gulp.darwin-amd64.tar.gz gulp +env GOOS=darwin GOARCH=arm64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-darwin-arm64" -o gulp && tar cfz gulp.darwin-arm64.tar.gz gulp +env GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/thoom/gulp/client.buildVersion=$RELEASE_VERSION-windows" -o gulp && zip gulp.windows.zip gulp \ No newline at end of file From 31340e29dbd8ccd35ed8c3f4c8bafca84fd89bd3 Mon Sep 17 00:00:00 2001 From: Zach Peacock <1316813+thoom@users.noreply.github.com> Date: Tue, 8 Feb 2022 20:10:29 -0700 Subject: [PATCH 2/3] Fixed syntax error --- .github/workflows/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e7746ac..8c6112d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,15 +45,16 @@ jobs: body: ${{ steps.bumpr.outputs.message }} draft: false prerelease: false - - # Build release + + - uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + # Build release - name: Build project if: "steps.tag.outputs.value != ''" env: RELEASE_VERSION: ${{ steps.tag.outputs.value }} - uses: actions/setup-go@v2 - with: - go-version: 1.17.x run: | ./scripts/build.sh From 052a789ec7c690fedb641d91cba8f98a094a99bb Mon Sep 17 00:00:00 2001 From: Zach Peacock <1316813+thoom@users.noreply.github.com> Date: Tue, 8 Feb 2022 20:12:12 -0700 Subject: [PATCH 3/3] Push Versioned Docker image --- scripts/deploy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index ff792a6..da0abd1 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -4,4 +4,5 @@ docker login -u $DOCKER_USER -p $DOCKER_PASS docker tag gulp thoom/gulp:latest docker tag gulp thoom/gulp:$RELEASE_VERSION -docker push thoom/gulp \ No newline at end of file +docker push thoom/gulp:latest +docker push thoom/gulp:$RELEASE_VERSION \ No newline at end of file