Skip to content

Optimize chore configuration #4557

Optimize chore configuration

Optimize chore configuration #4557

Workflow file for this run

name: Coverage
on:
workflow_dispatch:
pull_request:
branches:
- master
paths-ignore:
- "**/README.md"
push:
branches:
- master
paths-ignore:
- "**/README.md"
env:
TARPAULIN_VERSION: 0.20.1
CARGO_INCREMENTAL: 0
jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.PAT_RUNNER }}
ec2-image-id: ${{ secrets.EC2_IMAGE_ID }}
ec2-instance-type: ${{ secrets.EC2_INSTANCE_TYPE }}
subnet-id: ${{ secrets.SUBNET_ID }}
security-group-id: ${{ secrets.SECURITY_GROUP_ID }}
aws-resource-tags: >
[
{"Key": "Name", "Value": "${{ github.workflow }}"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
test:
name: Coverage Report
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
steps:
- name: cleaning up
run: |
echo '${{ secrets.RUNNER_PASSWORD }}' | sudo -S chown -R $USER:$USER $GITHUB_WORKSPACE
echo "HOME=/home/ubuntu" >> ${GITHUB_ENV}
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-11-15
components: rustfmt
target: wasm32-unknown-unknown
default: true
path: ""
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Run cargo-tarpaulin
run: |
wget https://github.com/xd009642/tarpaulin/releases/download/${{ env.TARPAULIN_VERSION }}/cargo-tarpaulin-${{ env.TARPAULIN_VERSION }}-travis.tar.gz
tar -zxvf cargo-tarpaulin-${{ env.TARPAULIN_VERSION }}-travis.tar.gz -C $HOME/.cargo/bin
cargo +nightly-2022-11-15 tarpaulin --verbose --no-fail-fast \
-p pallet-loans \
-p pallet-liquid-staking \
-p pallet-farming \
-p pallet-prices \
-p pallet-amm \
-p pallet-stableswap \
-p pallet-router \
-p pallet-crowdloans \
-p pallet-emergency-shutdown \
-p pallet-bridge \
-p pallet-asset-registry \
-p pallet-streaming \
--timeout 300 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
token: ${{secrets.CODECOV_TOKEN}}
- name: slack
uses: 8398a7/action-slack@v3
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,eventName,ref,workflow
if: always()
stop-runner:
name: stop self-hosted EC2 runner
needs:
- start-runner
- test
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.PAT_RUNNER }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}