Skip to content

Display scale down behavior just when is available #801

Display scale down behavior just when is available

Display scale down behavior just when is available #801

Workflow file for this run

name: Go
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.21
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
shell: bash
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.21
- uses: actions/checkout@v1
- run: make metalint
docker_deploy:
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
name: "publish image on dockerhub"
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: List docker image tags
uses: docker/metadata-action@v4
id: dockermeta
with:
images: tsuru/client
tags: |
type=match,value=latest,pattern=\d.\d.\d
type=edge
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Get version from tag
id: gittag
uses: jimschubert/query-tag-action@v1
with:
commit-ish: HEAD
- name: Build and Push image to docker hub
uses: docker/build-push-action@v3
with:
file: ./Dockerfile
build-args: |
TSURU_BUILD_VERSION="${{steps.gittag.outputs.tag}}"
push: true
tags: ${{ steps.dockermeta.outputs.tags }}
labels: ${{ steps.dockermeta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
deploy:
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
needs: [test, lint]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: release
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
# The automatic GitHub token (namely secrets.GITHUB_TOKEN) doesn't have permission cross-project.
HOMEBREW_TSURU_REPOSITORY_AUTH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.PRIVATE_SSH_KEY }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: packagecloud
run: ./misc/build_publish_to_packagecloud.sh
env:
PACKAGE_NAME: tsuru-client
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
SKIP_GORELEASER: "true"