Skip to content

update dependencies #179

update dependencies

update dependencies #179

Workflow file for this run

name: main
on:
pull_request:
push:
branches:
- 'main'
tags:
- 'v*'
env:
filename: "main.yaml"
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: docker run -d --network host gcr.io/etcd-development/etcd:v3.5.10
- run: make SUDO="sudo" setup
- run: make test-tools
- run: make check-generate
- run: make test
- name: Set version
id: version
run: |
VERSION=0.1
if ${{ startsWith(github.ref, 'refs/tags/v') }}; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- run: make deb VERSION=v${{ steps.version.outputs.version }}
- name: Upload etcdpasswd deb package
uses: actions/upload-artifact@v3
with:
name: etcdpasswd
path: etcdpasswd_${{ steps.version.outputs.version }}-1_amd64.deb
retention-days: 1
mtest:
name: Mtest
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.NECO_TEST_SERVICE_ACCOUNT }}
- name: Set up Cloud SDK for etcdpasswd
uses: google-github-actions/setup-gcloud@v1
- name: Set GCP instance name
run: echo "INSTANCE_NAME=etcdpasswd-${{ github.run_number }}-$(TZ=Asia/Tokyo date +%H%M%S)" >> $GITHUB_ENV
- run: |
if [[ ${{ github.event_name }} = "pull_request" ]]; then
GITHUB_SHA=$(cat ${GITHUB_EVENT_PATH} | jq -r '.pull_request.head.sha')
fi
./mtest/bin/run-mtest.sh
- name: Set the instance lifetime
if: ${{ failure() || cancelled() }}
run: |
. ./mtest/bin/env
$GCLOUD compute instances add-metadata ${INSTANCE_NAME} --zone ${ZONE} \
--metadata shutdown-at=$(date -Iseconds -d+30minutes)
- name: Notify to Slack
if: ${{ failure() || cancelled() }}
run: |
. ./mtest/bin/env
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
BRANCH_NAME=${GITHUB_HEAD_REF}
else
BRANCH_NAME=${GITHUB_REF#refs/heads/}
fi
curl -X POST -H 'Content-type: application/json' --data "{
\"blocks\": [
{
\"type\": \"section\",
\"text\": {
\"type\": \"mrkdwn\",
\"text\": \"Failed: ${{ github.actor }}'s workflow (${{ github.workflow }}) in <https://github.com/${{ github.repository }}/actions/workflows/${{ env.filename }}|${{ github.repository }}> (<https://github.com/${{ github.repository }}/actions/workflows/${{ env.filename }}?query=branch%3A${BRANCH_NAME}|${BRANCH_NAME}>)\n Do you extend the lifetime of ${INSTANCE_NAME}?\"
},
\"accessory\": {
\"type\": \"button\",
\"text\": {
\"type\": \"plain_text\",
\"text\": \"Extend\",
\"emoji\": true
},
\"value\": \"${INSTANCE_NAME}\"
}
}
]
}" ${{ secrets.SLACK_WEBHOOK_URL }}
release:
name: Release
needs: mtest
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
container:
image: ghcr.io/cybozu/golang:1.21-jammy # used for ghr, not for go command
steps:
- run: mkdir -p /tmp/upload
- name: Download etcdpasswd deb package
uses: actions/download-artifact@v4
with:
name: etcdpasswd
path: /tmp/upload
- run: |
OWNER=$(echo ${{ github.repository }} | cut -d '/' -f 1)
REPOSITORY=$(echo ${{ github.repository }} | cut -d '/' -f 2)
VERSION=${GITHUB_REF#refs/tags/v}
if ${{ contains(github.ref, '-') }}; then
PRERELEASE="-prerelease"
fi
ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${OWNER} -r ${REPOSITORY} -n v${VERSION} ${PRERELEASE} -b "See [CHANGELOG.md](./CHANGELOG.md) for details." v${VERSION} /tmp/upload