-
Notifications
You must be signed in to change notification settings - Fork 282
117 lines (90 loc) · 3.06 KB
/
checks.yml
File metadata and controls
117 lines (90 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: checks
on:
push:
branches: [master]
pull_request: {}
repository_dispatch:
types: [update-foundry-submodule-docs]
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run linter
run: yarn lint
tests:
strategy:
matrix:
package:
- core
- plugin-hardhat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: yarn --cwd "packages/${{matrix.package}}" run test
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run coverage
run: yarn coverage
- uses: codecov/codecov-action@v5
update-foundry-submodule-docs:
if: github.event_name == 'repository_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up environment
uses: ./.github/actions/setup
- name: Update submodule
run: |
cd submodules/openzeppelin-foundry-upgrades
git fetch origin main
git reset --hard origin/main
- name: Regenerate docs
run: yarn docs:foundry:ci
- name: Check for changes in docs/modules/ROOT/pages/foundry/
id: check_changes
run: |
[ -n "$(git diff --name-only HEAD -- docs/modules/ROOT/pages/foundry/)" ] && echo "SHOULD_COMMIT_DOC_UPDATE=true" >> $GITHUB_ENV || true
- name: Set Git identity
if: env.SHOULD_COMMIT_DOC_UPDATE == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create new branch, commit and push changes
if: env.SHOULD_COMMIT_DOC_UPDATE == 'true'
run: |
BRANCH_NAME="ci/update-foundry-docs-$(date +'%Y-%m-%d-%H%M%S')-${{ github.run_id }}"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
git checkout -b $BRANCH_NAME
git add docs/modules/ROOT/pages/foundry/ submodules/openzeppelin-foundry-upgrades/
git commit -m "[CI] Update Foundry Upgrades plugin docs"
git push origin $BRANCH_NAME
- name: Create a Pull Request for docs changes
id: create_pull_request
if: env.SHOULD_COMMIT_DOC_UPDATE == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "[CI] Update Foundry Upgrades plugin docs" \
--body "This Pull Request updates the docs for the Foundry Upgrades plugin" \
--base master \
--head $BRANCH_NAME || echo "Pull Request creation failed"
- name: Clean up branch if Pull Request creation fails
if: steps.create_pull_request.outcome == 'failure'
run: |
git push origin --delete $BRANCH_NAME