Skip to content

Fix solidity.yml

Fix solidity.yml #52

Workflow file for this run

# Test
# TODO: Reusify and combine with the `check-lurk-compiles` action and/or make a reusable open-issue action
# This workflow runs compatibility tests on a PR
# On a `pull_request` failure, it writes a PR comment to ensure the author/reviewer are notified
# On a `merge_group` failure, it opens an issue in the downstream repo that compatibility has been broken
# It is not intended to be a required status check, only to noisily surface breaking changes
name: Test Solidity Compatibility
on:
merge_group:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
solidity-compat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: lurk-lab/ci-workflows
- uses: ./.github/actions/ci-env
- uses: actions/checkout@v4
with:
submodules: recursive
#- uses: dtolnay/rust-toolchain@stable
#- uses: taiki-e/install-action@nextest
#- uses: Swatinem/rust-cache@v2
#- run: cargo nextest run -E 'test(test_solidity_compatibility_ipa)' --release --run-ignored all
# id: solidity-test
# continue-on-error: true
- run: exit 1
id: solidity-test
continue-on-error: true
## Prepares env vars for use in a PR comment or issue in `solidity-verifier`
- name: Set env vars
#if: steps.solidity-test.outcome != 'success'
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
SHA=${{ github.event.pull_request.head.sha }}
PR_NUMBER=${{ github.event.pull_request.number }}
else
SHA=${{ github.event.merge_group.head_sha }}
PR_NUMBER=$(echo ${{ github.event.merge_group.head_ref }} | sed -e 's/.*pr-\(.*\)-.*/\1/')
fi
GITHUB_URL=https://github.com/${{ github.repository }}
WORKFLOW_URL=$GITHUB_URL/actions/runs/${{ github.run_id }}
PR_URL=$GITHUB_URL/pull/$PR_NUMBER
echo "WORKFLOW_URL=$WORKFLOW_URL" | tee -a $GITHUB_ENV
echo "WORKFLOW_FILE=$WORKFLOW_URL/workflow" | tee -a $GITHUB_ENV
echo "COMMIT=$SHA" | tee -a $GITHUB_ENV
echo "PR_URL=$PR_URL" | tee -a $GITHUB_ENV
#- name: Comment on failing run
# if: steps.solidity-test.outcome != 'success' && github.event_name == 'pull_request'
# uses: peter-evans/create-or-update-comment@v4
# with:
# issue-number: ${{ github.event.pull_request.number }}
# body: |
# `solidity-verifier` compatibility test failed :x:
# ${{ env.WORKFLOW_URL }}
# Open issue in downstream repo
- uses: actions/checkout@v4
#if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
with:
repository: lurk-lab/ci-workflows
# Have to check out the upstream repo again to get the issue template
# Ideally we'd run JasonEtco/create-an-issue in a subdirectory but this isn't possible
- uses: actions/checkout@v4
#if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
with:
repository: lurk-lab/ci-lab
path: ${{ github.workspace }}/template
sparse-checkout: |
.github/templates/SOLIDITY_COMPAT_ISSUE.md
sparse-checkout-cone-mode: false
- run: |
find $PWD/template/.github/* -type f
#if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
- uses: falnyr/replace-env-vars-action@master
#if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
env:
WORKFLOW_URL: ${{ env.WORKFLOW_URL }}
WORKFLOW_FILE: ${{ env.WORKFLOW_FILE }}
COMMIT: ${{ env.COMMIT }}
PR_URL: ${{ env.PR_URL }}
with:
filename: ./template/.github/templates/SOLIDITY_COMPAT_ISSUE.md
# Test if it updates automatically or I need to input the issue number if it exists
- uses: peter-evans/create-issue-from-file@v5
#if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
with:
token: ${{ secrets.REPO_TOKEN }}
repository: lurk-lab/ci-workflows
title: ":rotating_light: Arecibo compatibility is broken"
content-filepath: ./template/.github/templates/SOLIDITY_COMPAT_ISSUE.md
labels: |
debt
automated-issue
# Prevent merge of required check (test)
- if: steps.solidity-test.outcome != 'success' && (github.event_name != 'pull_request' || github.event.action == 'enqueued')
run: exit 1