Partner Chains Smart Contracts CI #464
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: 'Partner Chains Smart Contracts CI' | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
workflow_dispatch: | |
env: | |
AWS_DEFAULT_REGION: eu-central-1 | |
jobs: | |
build-x64-linux: | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: [ self-hosted, Linux ] | |
env: | |
# Modify this value to "invalidate" the cabal cache. | |
CABAL_CACHE_VERSION: "2024-11-14" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ github.token }} | |
- name: Add signing key for nix | |
run: echo "${{ secrets.NIX_SIGNING_KEY }}" > "${{ runner.temp }}/nix-key" | |
- name: Enter nix shell | |
run: nix develop && cd onchain | |
# - name: Record dependencies to be used as cache keys | |
# id: record-deps | |
# run: | | |
# nix develop && cd onchain | |
# cabal build all --enable-tests --dry-run --minimize-conflict-set | |
# cat dist-newstyle/cache/plan.json \ | |
# | jq '.["install-plan"][].id' \ | |
# | sort \ | |
# | uniq \ | |
# | tee dependencies.txt | |
# - name: Restore cache | |
# uses: actions/cache/restore@v4 | |
# id: restore-cabal-cache | |
# with: | |
# path: | | |
# ~/.local/state/cabal/store | |
# ~/.cabal/store | |
# onchain/dist-newstyle | |
# key: ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }} | |
# restore-keys: | | |
# ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }} | |
# ${{ runner.os }}-${{ env.CABAL_CACHE_VERSION }}- | |
- name: Build dependencies | |
id: build-dependencies | |
run: cabal build all --only-dependencies | |
# - name: Save cache | |
# uses: actions/cache/save@v4 | |
# id: save-cabal-cache | |
# if: steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true' | |
# with: | |
# path: | | |
# ~/.local/state/cabal/store | |
# ~/.cabal/store | |
# onchain/dist-newstyle | |
# key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }} | |
- name: Lint sources | |
run: | | |
nix flake check | |
- name: Build onchain | |
run: | | |
make | |
# - name: Build offchain | |
# run: | | |
# cd offchain | |
# nix develop --command "make" | |
- name: Acquire AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
# - name: Copy nix scopes to nix cache | |
# run: | | |
# nix-store --stdin -q --deriver < ${{ runner.temp }}/outputs | nix-store --stdin -qR --include-outputs \ | |
# | nix copy --stdin --to \ | |
# "s3://cache.sc.iog.io?secret-key=${{ runner.temp }}/nix-key®ion=$AWS_DEFAULT_REGION" \ | |
# && rm ${{ runner.temp }}/outputs | |
# test-x64-linux: | |
# permissions: | |
# id-token: write | |
# contents: read | |
# runs-on: [ self-hosted, Linux ] | |
# needs: | |
# - build-x64-linux | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# with: | |
# token: ${{ github.token }} | |
# - name: Run tests | |
# run: | | |
# cd offchain | |
# nix-shell --run "make test" |