Skip to content

Commit

Permalink
break up the docker commands to use github git diff since it doesn't …
Browse files Browse the repository at this point in the history
…play nice in the container
  • Loading branch information
tateexon committed May 9, 2024
1 parent 282b05c commit 3b02ed8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
48 changes: 35 additions & 13 deletions .github/actions/build_contract_artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ inputs:
runs:
using: composite
steps:
- name: Docker run
if: ${{ inputs.image != '' && inputs.image-version != '' }}
shell: bash
run: docker run -v $(pwd):/repo projectserum/build:v0.27.0 bash -c "/repo/scripts/build-contract-artifacts-action.sh"

# should be used again after moving from projectserum/build to backpackapp/build
- name: Checkout solana
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
repository: smartcontractkit/chainlink-solana
ref: ${{ inputs.ref }}
- name: Install latest Git version (>= 2.18.0) for actions/checkout
if: ${{ inputs.image == '' && inputs.image-version == '' }}
shell: bash
run: |
apt-get update
Expand All @@ -30,12 +28,36 @@ runs:
apt update
apt install git -y
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout solana
if: ${{ inputs.image == '' && inputs.image-version == '' }}
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
repository: smartcontractkit/chainlink-solana
ref: ${{ inputs.ref }}
# temporary docker run to build artifacts
- name: Builder Start
if: ${{ inputs.image != '' && inputs.image-version != '' }}
env:
image: ${{ inputs.image }}
image_version: ${{ inputs.image-version }}
shell: bash
run: docker run -d -v $(pwd):/repo --name build-container "${image}":"${image_version}" tail -f /dev/null
- name: Docker build
if: ${{ inputs.image != '' && inputs.image-version != '' }}
shell: bash
run: docker exec -it build-container bash -c "/repo/scripts/build-contract-artifacts-action.sh"
- name: Check generated go bindings are up to date
if: ${{ inputs.image != '' && inputs.image-version != '' }}
shell: bash
run: git diff --stat --exit-code
- name: Docker generate keys and build
if: ${{ inputs.image != '' && inputs.image-version != '' }}
shell: bash
run: |
docker exec -it build-container bash -c "\
export RUSTUP_HOME=\"/root/.rustup\" &&\
cd /repo &&\
./scripts/programs-keys-gen.sh &&\
cd ./contracts &&\
anchor build"
# should be used again after moving from projectserum/build to backpackapp/build
- name: Setup go
if: ${{ inputs.image == '' && inputs.image-version == '' }}
uses: actions/setup-go@v4
Expand Down
12 changes: 6 additions & 6 deletions scripts/build-contract-artifacts-action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ cd "${REPO}"
./scripts/anchor-go-gen.sh

# check if the go interfaces have changed
git diff --stat --exit-code
# git diff --stat --exit-code

# generate program keys
./scripts/programs-keys-gen.sh
# # generate program keys
# ./scripts/programs-keys-gen.sh

# build the contracts with updated keys
cd "${CONTRACTS}"
anchor build
# # build the contracts with updated keys
# cd "${CONTRACTS}"
# anchor build

0 comments on commit 3b02ed8

Please sign in to comment.