Update dependencies #244
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
env: | |
filename: 'main.yaml' | |
jobs: | |
static-check: | |
name: Static Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Install test tools | |
run: make SUDO="sudo" test-tools | |
- name: Check auto-generated files | |
run: make check-generate | |
- name: Run code check tools | |
run: make code-check | |
unit-test: | |
name: Unit Test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Install test tools | |
run: make SUDO="sudo" test-tools | |
- name: Build binaries | |
run: make build | |
- name: Run test | |
run: make test | |
e2e-test: | |
name: e2e Test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Install test tools | |
run: make SUDO="sudo" test-tools | |
- name: Setup cfssl | |
run: make SUDO="sudo" setup-cfssl | |
- name: Build binaries | |
run: make build | |
- name: Run test | |
run: make e2e | |
build-image: | |
name: Build Images | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Build image | |
run: make docker-build | |
mtest: | |
name: Multi-host test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.NECO_TEST_SERVICE_ACCOUNT }}' | |
- name: Set up Cloud SDK for sabakan | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Set GCP instance name | |
run: echo "INSTANCE_NAME=sabakan-${{ github.run_number }}-$(TZ=Asia/Tokyo date +%H%M%S)" >> $GITHUB_ENV | |
- name: Watch sabakan logs | |
run: ./bin/watch_service sabakan > sabakan-service.log & | |
- name: Run mtest | |
run: | | |
if [ ${{ github.event_name }} = "pull_request" ]; then | |
GITHUB_SHA=$(cat ${GITHUB_EVENT_PATH} | jq -r '.pull_request.head.sha') | |
fi | |
./bin/run-mtest.sh | |
- name: Show sabakan logs | |
if: ${{ always() }} | |
run: cat sabakan-service.log | |
- name: Set the GCP instance lifetime | |
if: ${{ failure() || cancelled() }} | |
run: | | |
. ./bin/env | |
$GCLOUD compute instances add-metadata ${INSTANCE_NAME} --zone ${ZONE} \ | |
--metadata shutdown-at=$(date -Iseconds -d+30minutes) | |
- name: Notify to Slack if failed or cancelled | |
if: ${{ failure() || cancelled() }} | |
run: | | |
. ./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 }} | |
- name: Delete CI instance if succeeded | |
if: ${{ success() }} | |
run: | | |
. ./bin/env | |
$GCLOUD compute instances delete ${INSTANCE_NAME} --zone ${ZONE} |