Merge pull request #4812 from berty/dependabot/go_modules/github.com/… #5
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: Integration | |
on: | |
# @moul: temporarily disabled. | |
# the test is flappy and the current notification system make it not very useful. | |
# I think that we should move the prod integration test to an external monitoring and only keep the CI/CD related integration test here. | |
#schedule: | |
# - cron: '0 * * * *' | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
paths: | |
- 'go/**' | |
- '!go/**.md' | |
- 'go.*' | |
- '**.go' | |
- 'js/**' | |
- '!js/packages/i18n/locale/*/*.json' | |
- '.github/workflows/integration.yml' | |
pull_request: | |
paths: | |
- 'go/**' | |
- '!go/**.md' | |
- 'go.*' | |
- '**.go' | |
- 'js/**' | |
- '!js/packages/i18n/locale/*/*.json' | |
- '.github/workflows/integration.yml' | |
# FIXME: | |
# * test on production periodically with env=production | |
# * test against a fresh docker compose infra on each commit | |
# * store performance logs for comparison | |
jobs: | |
integration-prod: | |
if: github.event_name == 'schedule' | |
name: Integration (Production) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate run's URL | |
id: url | |
run: | | |
echo "::set-output name=runUrl::https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Load variables from file | |
uses: antifree/[email protected] | |
with: | |
filename: .github/workflows/utils/variables.json | |
- name: Setup asdf | |
uses: asdf-vm/actions/setup@v1 | |
- name: Setup go | |
run: | | |
asdf plugin add golang | |
asdf install golang | |
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV | |
- name: Cache Go modules | |
uses: actions/[email protected] | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}- | |
- name: Avoid triggering make generate | |
run: touch go/gen.sum | |
- name: Fetch dependencies | |
run: go mod download | |
- name: Compile the integration binary | |
working-directory: go | |
run: | |
go install ./cmd/berty-integration | |
asdf reshim golang # See: https://github.com/kennyp/asdf-golang/issues/18 | |
- name: Run integration test suite | |
run: | | |
berty-integration \ | |
-p2p.disc-disable-filter=true \ | |
-integration.testbot=`cat ./config/config.gen.json | jq -r '.berty.contacts["testbot"].link'` \ | |
-integration.benchmark > benchmark_result.json | |
- name: Download previous benchmark data | |
uses: actions/[email protected] | |
with: | |
path: ./cache | |
key: ${{runner.os}}-integration-benchmark | |
- name: Discord notification | |
if: failure() | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_PROD_WEBHOOK }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: 'Integration failed, see ${{ steps.url.outputs.runUrl }}' | |
integration-local: | |
if: github.event_name == 'push' || github.event_name == 'pull_request' | |
name: Integration (Local) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build Docker images | |
working-directory: tool/integration-compose | |
run: docker compose build | |
- name: Run integration test suite | |
working-directory: tool/integration-compose | |
run: make | |
#- name: Store benchmark result | |
# uses: rhysd/github-action-benchmark@v1 | |
# with: | |
# tool: 'googlecpp' | |
# output-file-path: benchmark_result.json | |
# external-data-json-path: ./cache/benchmark-data.json | |
# fail-on-alert: false | |
# comment-on-alert: true | |
# github-token: ${{secrets.GITHUB_TOKEN}} | |
# #alert-comment-cc-users: '@foobar' | |
# #auto-push: true | |
doctor-production: | |
name: Doctor (Production) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate run's URL | |
id: url | |
run: | | |
echo "::set-output name=runUrl::https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Load variables from file | |
uses: antifree/[email protected] | |
with: | |
filename: .github/workflows/utils/variables.json | |
- name: Setup asdf | |
uses: asdf-vm/actions/setup@v1 | |
- name: Setup go | |
run: | | |
asdf plugin add golang | |
asdf install golang | |
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV | |
- name: Cache Go modules | |
uses: actions/[email protected] | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}- | |
- name: Avoid triggering make generate | |
run: touch go/gen.sum | |
- name: Fetch dependencies | |
run: go mod download | |
- name: Compile the doctor binary | |
working-directory: go | |
run: | | |
go install ./cmd/berty-doctor | |
asdf reshim golang # See: https://github.com/kennyp/asdf-golang/issues/18 | |
- name: Run doctor | |
run: berty-doctor -v | |
- name: Discord notification | |
if: github.event_name == 'schedule' && failure() | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_PROD_WEBHOOK }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: 'Doctor failed, see ${{ steps.url.outputs.runUrl }}' |