Skip to content

Commit 7d22a67

Browse files
rob1997robGG1997
andauthored
CI Improvements & Optimizations (#1198)
* Revert "automated duplicating imported samples modifications (#595)" This reverts commit a555894. * made main package testable, revert due to a mistake * initial commit to test CI * path updated * path updated for linux * Packages version changes implemented * Program renamed to Setup * checkpoint before testing git * git push added * proper logging * more log check * more log test * powershell added * added missing command line argument * reverted to run with bash * removed powershell package * exception support * configure and push added * deploy key added for push * bad substitution fix * github env vars setup * checkpoint * tags and dependency version changes * manual workflow and release added * release version from input * cool-er title for release workflow * Ignore serialization only, on some Package properties * removed unused using statement * documentation added * first draft for duplicate sample and fixed release * fixed parallel run of jobs * extra arguments for release Git push added as a runnable so push happens at the end release order changed * new trigger for testing * fixed compile error * documentation * added ref branch to commit on pull requst * removed additional arguments for release * setup works on both workflow call or form workflow dispatch * cache test * compile error fix * parallel fix * removed push at the end * sync dependencies done * added dotnet restore * removed restore added git enable property * update submodule before dotnet run * git fix * default case added for runnable args switch * release by default, git enabled by default and duplicate and sync now can also be triggered manually * cleaned up scripts * workflows updated and optimized * more workflow updates and optimizations * parallel runs (to save time) * test sync branches * fetch added * main renamed * --allow-unrelated-histories flag added * git config added * sync branches to main workflow * git back to static * reverted sample duplicate test * parallel run to save some time --------- Co-authored-by: robGG1997 <[email protected]>
1 parent 183e9f7 commit 7d22a67

39 files changed

+801
-570
lines changed

.github/workflows/check_and_commit.yml

Lines changed: 0 additions & 136 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Duplicate Samples
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
inputs:
7+
arguments:
8+
required: false
9+
description: 'Run Arguments'
10+
type: string
11+
configuration:
12+
required: true
13+
description: 'Run Configuration'
14+
default: 'Release'
15+
type: choice
16+
options:
17+
- Release
18+
- Debug
19+
20+
jobs:
21+
setup:
22+
name: Duplicate Samples 🪞
23+
uses: ChainSafe/web3.unity/.github/workflows/setup.yaml@main
24+
with:
25+
arguments: "-duplicate_samples ${{ github.event.inputs.arguments || '-git:enabled' }} -c ${{ github.event.inputs.configuration || 'Release' }}"
26+
secrets: inherit
27+

.github/workflows/pull_request_checks.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@ on:
55

66
jobs:
77
web3_tests:
8-
name: Web3 Tests
8+
name: Web3 tests 🕸
99
if: ${{ github.event.action == 'ready_for_review' || github.event.label.name == 'ready-to-merge'}}
1010
uses: ChainSafe/web3.unity/.github/workflows/test.yaml@main
1111
analyze_code:
12-
name: Analyze Code
12+
name: Analyze 🧐
1313
uses: ChainSafe/web3.unity/.github/workflows/codeql.yml@main
14-
needs: [ web3_tests ]
15-
unity_tests:
16-
name: Unity Tests
14+
sync_dependencies:
15+
name: Sync Dependencies 🔄
1716
if: ${{ github.base_ref == 'main' }}
18-
uses: ChainSafe/web3.unity/.github/workflows/check_and_commit.yml@main
19-
needs: [ analyze_code ]
17+
uses: ChainSafe/web3.unity/.github/workflows/sync_dependencies.yaml@main
18+
needs: [ web3_tests , analyze_code ]
19+
secrets: inherit
20+
duplicate_samples:
21+
name: Duplicate Samples 🪞
22+
uses: ChainSafe/web3.unity/.github/workflows/duplicate_samples.yaml@main
23+
needs: [ sync_dependencies ]
24+
secrets: inherit
25+
unity_tests:
26+
name: Unity Tests 🧪
27+
uses: ChainSafe/web3.unity/.github/workflows/unity_tests.yml@main
28+
needs: [ sync_dependencies ]
2029
secrets: inherit

.github/workflows/push_checks.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Post Push Checks and Commits
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
7+
jobs:
8+
sync_dependencies:
9+
name: Sync Dependencies 🔄
10+
uses: ChainSafe/web3.unity/.github/workflows/sync_dependencies.yaml@main
11+
secrets: inherit
12+
duplicate_samples:
13+
name: Duplicate Samples 🪞
14+
uses: ChainSafe/web3.unity/.github/workflows/duplicate_samples.yaml@main
15+
needs: [ sync_dependencies ]
16+
secrets: inherit
17+
unity_tests:
18+
name: Unity Tests 🧪
19+
uses: ChainSafe/web3.unity/.github/workflows/unity_tests.yml@main
20+
needs: [ sync_dependencies ]
21+
secrets: inherit
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Post Push Checks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
sync_branches:
9+
name: Sync Branches ♾️
10+
uses: ChainSafe/web3.unity/.github/workflows/sync_branches.yaml@main
11+
with:
12+
branch: dev
13+
secrets: inherit

.github/workflows/release.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,22 @@ on:
1010
description: 'Version Release Notes'
1111
required: true
1212

13-
env:
14-
git_email: "${{ github.actor }}@users.noreply.github.com"
15-
git_actor: "${{ github.actor }}"
16-
1713
jobs:
1814
setup:
1915
name: Setup job
16+
uses: ChainSafe/web3.unity/.github/workflows/setup.yaml@main
17+
with:
18+
arguments: "-release:${{ github.event.inputs.version }}"
19+
secrets: inherit
20+
release:
21+
name: Release job
2022
runs-on: ubuntu-latest
23+
needs: [ setup ]
2124
steps:
2225
- name: Checkout repository
2326
uses: actions/checkout@v4
2427
with:
25-
lfs: true
26-
ssh-key: ${{ secrets.DEPLOY_KEY }}
27-
28-
- name: Setup .NET
29-
uses: actions/setup-dotnet@v3
30-
with:
31-
dotnet-version: 8.0.x
32-
33-
- name: Run
34-
run: |
35-
cd Setup
36-
dotnet run -release:${{ github.event.inputs.version }} Setup/Setup.csproj
28+
lfs: true
3729
- name: Create Release
3830
id: create_release
3931
uses: actions/create-release@v1

.github/workflows/setup.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Setup ⚙️
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
arguments:
7+
required: true
8+
type: string
9+
workflow_dispatch:
10+
inputs:
11+
arguments:
12+
required: true
13+
description: 'Arguments to pass to the setup script'
14+
type: string
15+
env:
16+
git_email: "${{ github.actor }}@users.noreply.github.com"
17+
git_actor: "${{ github.actor }}"
18+
19+
jobs:
20+
setup:
21+
name: Setup job
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.head_ref || github.ref_name }}
28+
lfs: true
29+
ssh-key: ${{ secrets.DEPLOY_KEY }}
30+
- name: update submodules
31+
run: |
32+
git submodule update --init
33+
shell: bash
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v3
36+
with:
37+
dotnet-version: 8.0.x
38+
39+
- name: Run
40+
run: |
41+
cd Setup
42+
dotnet run ${{ inputs.arguments || github.event.inputs.arguments }} Setup/Setup.csproj
43+
git reset --hard
44+
- name: Cache
45+
uses: actions/cache/save@v4
46+
with:
47+
path: .git
48+
key: ${{ runner.os }}-git
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Sync Branches
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
branch:
7+
required: true
8+
type: string
9+
workflow_dispatch:
10+
inputs:
11+
branch:
12+
required: true
13+
description: "Branch to Sync"
14+
type: string
15+
16+
jobs:
17+
setup:
18+
name: Sync Branches ♾️
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref || github.ref_name }}
25+
lfs: true
26+
ssh-key: ${{ secrets.DEPLOY_KEY }}
27+
- name: Sync Branches
28+
run: |
29+
git config user.email $git_email
30+
git config user.name $git_actor
31+
git fetch origin ${{ github.event.inputs.branch }}
32+
git merge main --allow-unrelated-histories
33+
git push
34+
shell: bash
35+
env:
36+
git_email: "${{ github.actor }}@users.noreply.github.com"
37+
git_actor: "${{ github.actor }}"

0 commit comments

Comments
 (0)