Skip to content

Merge pull request #4892 from berty/dependabot/npm_and_yarn/js/web/na… #10

Merge pull request #4892 from berty/dependabot/npm_and_yarn/js/web/na…

Merge pull request #4892 from berty/dependabot/npm_and_yarn/js/web/na… #10

Workflow file for this run

name: Protobuf
on:
push:
tags:
- v*
branches:
- master
paths:
- "api/**"
- "Makefile"
- "js/Makefile"
- "go/Makefile"
- "config/**"
- "docs/Makefile"
- ".github/workflows/protobuf.yml"
- "js/packages/i18n/locale/en/messages.json"
- "**/gen.sum"
- "**.pb.go"
- "**.gen.go"
- "**.gen.graphql"
- "**.gen.js"
- "**.gen.ts"
- "**.gen.tsx"
- "**.gen.yml"
- "**.pb.d.ts"
- "**.pb.go"
- "**.pb.js"
- "**/pb_test.go"
- "**/docs/*/api.md"
- "**/gen.sum"
- "**/go.mod"
- "**/go.sum"
- "**/yarn.lock"
- "**/package.json"
- "**/Podfile.lock"
pull_request:
paths:
- "api/**"
- "Makefile"
- "js/Makefile"
- "go/Makefile"
- "config/**"
- "docs/Makefile"
- ".github/workflows/protobuf.yml"
- "js/packages/i18n/locale/en/messages.json"
- "**/gen.sum"
- "**.pb.go"
- "**.gen.go"
- "**.gen.graphql"
- "**.gen.js"
- "**.gen.ts"
- "**.gen.tsx"
- "**.gen.yml"
- "**.pb.d.ts"
- "**.pb.go"
- "**.pb.js"
- "**/pb_test.go"
- "**/docs/*/api.md"
- "**/gen.sum"
- "**/go.mod"
- "**/go.sum"
- "**/yarn.lock"
- "**/package.json"
- "**/Podfile.lock"
jobs:
gen-go-and-docs:
name: Generate go protobuf and docs
runs-on: ubuntu-latest
container: bertytech/protoc:31
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Remove lock files
run: find . -name gen.sum ! -path './js/*' -delete
- 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: Setup jq
run: |
asdf plugin add jq
asdf install jq
- 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: Fetch go modules
run: go mod download
- name: Generate docs
working-directory: docs
run: make generate_local
- name: Generate go protobuf
working-directory: go
run: |
make generate_local
git checkout ../go.mod ../go.sum
- name: Check diff
run: |
git status | cat
git diff -w | cat
git diff-index -w --quiet HEAD --
- name: Prepare openapi documentation
working-directory: docs
run: make openapi.prepare
- name: Setup apiary
run: apk --no-cache add ruby-dev g++ && gem install apiaryio
- name: Upload API docs to apiary.io
env:
APIARY_API_KEY: "${{ secrets.APIARY_API_KEY }}"
if: ${{ env.APIARY_API_KEY != 0 }}
run: |
apiary publish --api-name=bertymessenger --path="docs/.tmp/openapi/bertymessenger.swagger.json" || true
gen-js:
name: Generate js protobuf
runs-on: ubuntu-latest
container: bertytech/protoc:31
steps:
- 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 node
run: |
asdf plugin add nodejs
asdf install nodejs
echo "node_version=$(asdf current nodejs | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- 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: Cleanup js gen
- run: make gen.clean
working-directory: js
- name: Cache node modules
uses: actions/[email protected]
with:
path: js/node_modules
key: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-${{ hashFiles('js/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-
- 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: Fetch node modules
# FIXME: find a way of only downloading the required packages or install them directly in the bertytech/protoc image
working-directory: js
run: make node_modules
- name: Fetch go modules
run: go mod download
- name: Generate js protobuf
working-directory: js
run: |
make _gen.pbjs
make _write_gen_sum
rm -f gen.sum && make generate
- name: Check diff
run: |
go mod tidy
git status | cat
git diff -w | cat
git diff-index -w --quiet HEAD --