From ff18bd9a7562ba7c923d40c5445bf4153e43bfde Mon Sep 17 00:00:00 2001 From: gretzke Date: Thu, 25 Jul 2024 02:16:29 +0200 Subject: [PATCH 1/2] Add script to update submodules daily --- .github/workflows/update-submodules.yaml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/update-submodules.yaml diff --git a/.github/workflows/update-submodules.yaml b/.github/workflows/update-submodules.yaml new file mode 100644 index 0000000..f61f6ee --- /dev/null +++ b/.github/workflows/update-submodules.yaml @@ -0,0 +1,49 @@ +name: Update Submodules + +on: + push: + branches: + - main + - staging + - dev + schedule: + # Run this workflow daily at 03:17 UTC + - cron: "17 3 * * *" + +jobs: + update-submodules: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update Submodules + run: | + git submodule update --init --remote + + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.DEPLOY_KEY }} + + - name: Check for Changes + id: git-check + run: | + echo "::set-output name=changes::$(git status --porcelain)" + + - name: Commit and Push if Changes are Present + if: steps.git-check.outputs.changes != '' + run: | + git remote set-url origin git@github.com:${{ github.repository }}.git + git add . + git commit -m "Update submodules" + git push From 6e7c79bf630374aad40bc8df632531c690cdd871 Mon Sep 17 00:00:00 2001 From: gretzke Date: Thu, 25 Jul 2024 02:19:28 +0200 Subject: [PATCH 2/2] remove test ci for now --- .github/workflows/coverage.yaml | 89 --------------------------------- .github/workflows/test.yaml | 40 --------------- 2 files changed, 129 deletions(-) delete mode 100644 .github/workflows/coverage.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index 98e1130..0000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,89 +0,0 @@ -name: code coverage - -on: - pull_request: - branches: [main, master, staging, dev] - -jobs: - comment-forge-coverage: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - - steps: - - name: Checkout code - uses: actions/checkout@v3 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - name: Run Forge build - run: | - forge --version - forge build --sizes - id: build - - name: Run forge coverage - id: coverage - run: | - { - echo 'COVERAGE<> "$GITHUB_OUTPUT" - echo $GITHUB_OUTPUT - env: - FOUNDRY_RPC_URL: "${{ secrets.RPC_URL }}" - - - name: Check coverage is updated - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const fs = require('fs'); - const file = "coverage.txt" - if(!fs.existsSync(file)) { - console.log("Nothing to check"); - return - } - const currentCoverage = fs.readFileSync(file, "utf8").trim(); - const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim(); - if (newCoverage != currentCoverage) { - core.setFailed(`Code coverage not updated. Run : forge coverage --no-match-coverage "(test)" | grep '^|' > coverage.txt`); - } - - - name: Comment on PR - id: comment - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const {data: comments} = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }) - - const botComment = comments.find(comment => comment.user.id === 41898282) - - const output = `${{ steps.coverage.outputs.COVERAGE }}`; - const commentBody = `Forge code coverage:\n${output}\n`; - - if (botComment) { - github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: commentBody - }) - } else { - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: commentBody - }); - } diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 5eabf40..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: test - -on: - pull_request: - branches: [main, master, staging, dev, feat/**, fix/**] - push: - branches: [main, master, staging, dev] - -env: - FOUNDRY_PROFILE: ${{ github.event_name == 'push' && 'ci' || 'pr' }} - -jobs: - forge-test: - strategy: - fail-fast: true - - name: Foundry project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - echo Foundry profile: $FOUNDRY_PROFILE - forge --version - forge build --sizes - id: build - - - name: Run Forge tests - run: forge test --isolate -vvv - id: test - env: - FORGE_SNAPSHOT_CHECK: true