Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow-to-build #12

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build
run-name: Building to ${{ inputs.deploy_target }} by @${{ github.actor }}
on:
push:
tags:
- v*
branches:
- master
# paths:
# - "js/**"
# - "config/**"
# - ".github/workflows/js.yml"
pull_request:
# paths:
# - "js/**"
# - "config/**"
# - ".github/workflows/js.yml"

jobs:
build-and-lint:
runs-on: ubuntu-latest
name: Build, lint and test
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup asdf
uses: asdf-vm/actions/setup@v2

- name: Setup tools
run: |
make asdf.install_plugins
echo "$(asdf current ruby -v)"
echo "node_version=$(asdf current nodejs | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV

# - name: Setup yarn
# run: |
# asdf plugin add yarn
# asdf install yarn

- name: Cache node modules
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.OS }}-node-${{ env.node_version }}-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ env.node_version }}-

- name: Fetch common node modules
run: make node_modules

# - name: Lint
# run: make lint

- name: Set TMPDIR environment variable
run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV

- name: Build IOS
run: make build.ios

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ src/api/rpcmanager.pb.d.ts: api/rpcmanager.proto

## go bind

bind.init: $(TMP)/.tool-versions .cache/bind/gomobile
bind.init: $(TMPDIR)/.tool-versions .cache/bind/gomobile
.cache/bind/gomobile: go.sum go.mod
@mkdir -p $(dir $@)
go build -o $@ golang.org/x/mobile/cmd/gomobile && chmod +x $@
$@ init
# FIXME(gfanton): find a more elegant way to make asdf works in the tmp directory
$(TMP)/.tool-versions: .tool-versions
@echo "> copying current `.tool-versions` in '$(TMP)' folder in order to make asdf works"
@echo "> this hack is needed in order for gomobile (who is building from '$(TMP)') bind to use the correct javac and go version"
$(TMPDIR)/.tool-versions: .tool-versions
@echo "> copying current `.tool-versions` in '$(TMPDIR)' folder in order to make asdf works"
@echo "> this hack is needed in order for gomobile (who is building from '$(TMPDIR)') bind to use the correct javac and go version"
@cp -v $< $@
bind.clean: _bind.clean.framework
rm -f $(TMP)/.tool-versions
rm -f $(TMPDIR)/.tool-versions
rm -rf .cache/bind

# use `nowatchdog` tags to build, see https://github.com/libp2p/go-libp2p-connmgr/issues/98
Expand Down
Loading