Skip to content

Bump library/golang from d56c3e0 to 7003184 #371

Bump library/golang from d56c3e0 to 7003184

Bump library/golang from d56c3e0 to 7003184 #371

Workflow file for this run

name: pr
on:
pull_request: {}
jobs:
tagfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # For $ git tag
- name: Ensure Tagfile is usable
run: grep -E '^[0-9]+[.][0-9]+[.][0-9]+$' Tagfile
- name: Checkout master Tagfile
uses: actions/checkout@v3
with:
ref: master
path: ./master-Tagfile
- name: Ensure Tagfile has changes
run: '! diff -q Tagfile ./master-Tagfile/Tagfile'
- name: Ensure tag wasn't published already
run: git tag | grep -vF $(cat Tagfile)
- name: Ensure new tag is a 1-increment
run: |
curr=$(cat Tagfile)
prev=./master-Tagfile/Tagfile
{
echo $(( $(cut -d. -f1 <$prev) + 1 )).$(cut -d. -f2 <$prev).$(cut -d. -f3 <$prev)
echo $(cut -d. -f1 <$prev).$(( $(cut -d. -f2 <$prev) + 1 )).$(cut -d. -f3 <$prev)
echo $(cut -d. -f1 <$prev).$(( $(cut -d. -f2 <$prev) + 1 )).0
echo $(cut -d. -f1 <$prev).$(cut -d. -f2 <$prev).$(( $(cut -d. -f3 <$prev) + 1 ))
} | awk '{ printf("%s ", $0) }' | grep -F "$curr"
tagfile-dependabot:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.pull_request.head.ref, 'dependabot/') }}
permissions:
contents: write
pull-requests: write
steps:
- uses: dependabot/fetch-metadata@v1
id: metadata
with:
skip-commit-verification: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0 # For $ git tag
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout master Tagfile
uses: actions/checkout@v3
with:
ref: master
path: ./master-Tagfile
sparse-checkout: Tagfile
sparse-checkout-cone-mode: false
- name: Ensure Tagfile has changes
run: |
if ! diff -q Tagfile ./master-Tagfile/Tagfile; then
cat ./master-Tagfile/Tagfile | awk -F. '/[0-9]+\./{$NF++;print}' OFS=. >Tagfile
fi
- name: Ensure Tagfile is bumping master Tagfile
run: |
if ! printf '%s pr\n%s master\n' "$(cat Tagfile)" "$(cat ./master-Tagfile/Tagfile)" | sort -u -V -k1 -r | head -n1 | grep master; then
cat ./master-Tagfile/Tagfile | awk -F. '/[0-9]+\./{$NF++;print}' OFS=. >Tagfile
fi
- name: Maybe push new Tagfile
run: |
set -x
git add Tagfile
COMMITHASH=$(git rev-parse --short HEAD)
if git status -bs Tagfile | grep Tagfile; then
git config --global user.name 'dependabot[bot]'
git config --global user.email '49699333+dependabot[bot]@users.noreply.github.com'
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-updates#allowing-dependabot-to-rebase-and-force-push-over-extra-commits
git commit --fixup "$COMMITHASH"
EDITOR=/usr/bin/cat git rebase -i --autosquash "$COMMITHASH"~
git push --force origin "$BRANCH"
fi
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-goimports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- run: go install github.com/incu6us/goimports-reviser/[email protected]
- run: which goimports-reviser
- run: find . -type f -iname '*.go' ! -iname '*.pb.go' -exec goimports-reviser {} \;
- run: git --no-pager diff --exit-code
check-nillness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- run: go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest ./...
checks:
runs-on: ubuntu-latest
strategy:
matrix:
check:
- goreleaser-dist
- ci-check--lint
- ci-check--mod
- ci-check--test
- ci-check--protolock
# - ci-check--protolock-force
- ci-check--protoc
steps:
- name: Set lowercase image name
run: echo IMAGE=ghcr.io/${SLUG,,} >>$GITHUB_ENV
env:
SLUG: ${{ github.repository }}
- uses: actions/checkout@v3
- uses: docker/[email protected]
- name: Log in to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/[email protected]
with:
files: ./docker-bake.hcl
targets: ${{ matrix.check }}
# TODO: cache-to
# set: |
# *.cache-to=type=registry,ref=${{ env.IMAGE }}:${{ matrix.check }},mode=max
- run: git --no-pager diff --exit-code
# TODO: cache-to
# - if: github.ref == 'refs/heads/master'
# name: If on master push image to GHCR
# run: docker push ${{ env.IMAGE }}:${{ matrix.check }}
- if: matrix.check == 'goreleaser-dist'
name: Test CLI
run: |
tar zxvf ./dist/monkey-Linux-x86_64.tar.gz -C .
./monkey -h | grep monkey
./monkey help | grep monkey
./monkey version
./monkey fmt
[[ $(./monkey version | wc -l) = 1 ]]
./monkey version | grep -F $(cat Tagfile)
./monkey --version | grep -F $(cat Tagfile)