Skip to content

try again

try again #76

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
FOUNDRY_PROFILE: ci
jobs:
set-tags:
runs-on: ubuntu-latest
outputs:
git_ref: ${{ steps.check-git-ref.outputs.git_ref }}
coverage_dir: ${{ steps.check-git-ref.outputs.coverage_dir }}
coverage_report: ${{ steps.check-git-ref.outputs.coverage_report }}
git_branch: ${{ steps.check-git-ref.outputs.git_branch }}
git_target_branch: ${{ steps.check-git-ref.outputs.git_target_branch }}
steps:
- name: Check git ref
id: check-git-ref
# if PR
# else if manual PR
# else (push)
run: |
if [[ -n "${{ github.event.pull_request.head.sha }}" ]]; then
echo "git_branch=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_OUTPUT
echo "git_target_branch=$(echo ${GITHUB_BASE_REF})" >> $GITHUB_OUTPUT
echo "git_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
echo "coverage_dir=tanssi-symbiotic-coverage/pulls/${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "coverage_report=true" >> $GITHUB_OUTPUT
else
echo "git_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "git_target_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
echo "git_ref=$GITHUB_REF" >> $GITHUB_OUTPUT
echo "coverage_dir=tanssi-symbiotic-coverage/branches/master" >> $GITHUB_OUTPUT
echo "coverage_report=false" >> $GITHUB_OUTPUT
fi
check:
strategy:
fail-fast: true
name: Foundry project
runs-on: ubuntu-latest
needs: ["set-tags"]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Show Forge version
run: |
forge --version
- name: Run Forge fmt
run: |
forge fmt --check
id: fmt
- name: Run Forge build
run: |
forge build --sizes
id: build
- name: Run Forge tests
run: |
forge test -vvv
id: test
- name: Run Forge coverage
run: |
mkdir -p coverage
forge coverage --report lcov -r coverage/current.lcov
id: coverage
- name: Retrieve master coverage
run: |
wget ${{ vars.S3_BUCKET_URL }}/tanssi-symbiotic-coverage/branches/master/current.lcov \
-O coverage/base_lcov.lcov || true
- name: Install lcov
run: sudo apt install lcov
- name: Get diff
run: |
if [ -s base_lcov.lcov ]; then
genhtml -o coverage --baseline-file coverage/base_cov.lcov -- coverage/current.lcov
else
genhtml -o coverage -- coverage/current.lcov
fi
- name: Upload coverate to gha
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
- name: Upload coverage s3
if: ${{(github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push') }}
uses: mario-sangar/upload-s3-action@master
id: S3
with:
aws_key_id: ${{ secrets.S3_COVERAGE_ID }}
aws_secret_access_key: ${{ secrets.S3_COVERAGE_KEY }}
aws_bucket: ${{ vars.S3_COVERAGE_BUCKET }}
destination_dir: "${{ needs.set-tags.outputs.coverage_dir }}"
source_dir: "coverage"
acl: "none"
- name: Link To Report
if: ${{(github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push') }}
run: |
echo "${{steps.S3.outputs.object_key}}"
echo "${{ vars.S3_BUCKET_URL }}/${{steps.S3.outputs.object_key}}/html/index.html"