Skip to content

Commit b6c0df0

Browse files
committed
Refactor CI workflow to use vendor approach
Updates the CI workflow to use a vendor directory for common scripts instead of referencing them directly. Steps for linting, testing, security checks, and packing now use 'make' commands and environment variables, improving maintainability and consistency.
1 parent 58c7525 commit b6c0df0

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
GO_VERSION: ${{ env.GO_VERSION }}
3333
APP_PEM: ${{ secrets.APP_PEM }}
3434
APP_ID: ${{ secrets.APP_ID }}
35+
CI_READ_COMMON: ${{ secrets.AUTHZCACHE_TO_COMMON }}
3536

3637
lint:
3738
name: Lint and more checks
@@ -42,20 +43,21 @@ jobs:
4243
- name: Checkout code
4344
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4445

45-
- name: Checkout common scripts
46+
- name: Checkout common scripts as vendor
4647
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4748
with:
4849
repository: descope/common
4950
token: ${{ secrets.AUTHZCACHE_TO_COMMON }}
50-
path: common-repo
51+
path: vendor/github.com/descope/common
5152

52-
- name: Lint and more checks
53-
uses: ./common-repo/.github/actions/lint
54-
with:
55-
go_version: ${{ env.GO_VERSION }}
56-
scripts_folder: ./vendor/github.com/descope/common
53+
- name: Lint using vendor approach
54+
run: |
55+
make lint
56+
env:
57+
GO_VERSION: ${{ env.GO_VERSION }}
5758
APP_PEM: ${{ secrets.APP_PEM }}
5859
APP_ID: ${{ secrets.APP_ID }}
60+
CI_READ_COMMON: ${{ secrets.AUTHZCACHE_TO_COMMON }}
5961

6062
test:
6163
name: Run Tests
@@ -66,23 +68,22 @@ jobs:
6668
- name: Checkout code
6769
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6870

69-
- name: Checkout common scripts
71+
- name: Checkout common scripts as vendor
7072
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7173
with:
7274
repository: descope/common
7375
token: ${{ secrets.AUTHZCACHE_TO_COMMON }}
74-
path: common-repo
76+
path: vendor/github.com/descope/common
7577

76-
- name: Run Tests
77-
uses: ./common-repo/.github/actions/tests
78+
- name: Run Tests using vendor approach
79+
run: |
80+
make test
7881
env:
7982
DATABASE_PASSWORD: ${{ env.DATABASE_PASSWORD }}
80-
with:
81-
go_version: ${{ env.GO_VERSION }}
82-
scripts_folder: ./vendor/github.com/descope/common
83+
GO_VERSION: ${{ env.GO_VERSION }}
8384
APP_PEM: ${{ secrets.APP_PEM }}
8485
APP_ID: ${{ secrets.APP_ID }}
85-
min_coverage: 100
86+
CI_READ_COMMON: ${{ secrets.AUTHZCACHE_TO_COMMON }}
8687

8788
security:
8889
name: Run Security checks
@@ -93,20 +94,21 @@ jobs:
9394
- name: Checkout code
9495
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9596

96-
- name: Checkout common scripts
97+
- name: Checkout common scripts as vendor
9798
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9899
with:
99100
repository: descope/common
100101
token: ${{ secrets.AUTHZCACHE_TO_COMMON }}
101-
path: common-repo
102+
path: vendor/github.com/descope/common
102103

103-
- name: Run Security checks
104-
uses: ./common-repo/.github/actions/security
105-
with:
106-
go_version: ${{ env.GO_VERSION }}
107-
scripts_folder: ./vendor/github.com/descope/common
104+
- name: Run Security checks using vendor approach
105+
run: |
106+
make security
107+
env:
108+
GO_VERSION: ${{ env.GO_VERSION }}
108109
APP_PEM: ${{ secrets.APP_PEM }}
109110
APP_ID: ${{ secrets.APP_ID }}
111+
CI_READ_COMMON: ${{ secrets.AUTHZCACHE_TO_COMMON }}
110112

111113
pack:
112114
name: Pack and Upload
@@ -123,17 +125,18 @@ jobs:
123125
- name: Checkout code
124126
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
125127

126-
- name: Checkout common scripts
128+
- name: Checkout common scripts as vendor
127129
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
128130
with:
129131
repository: descope/common
130132
token: ${{ secrets.AUTHZCACHE_TO_COMMON }}
131-
path: common-repo
133+
path: vendor/github.com/descope/common
132134

133-
- name: Pack and Upload
134-
uses: ./common-repo/.github/actions/pack
135-
with:
136-
go_version: ${{ env.GO_VERSION }}
137-
action_token: ${{ secrets.AUTHZCACHE_TO_COMMON }}
135+
- name: Pack and Upload using vendor approach
136+
run: |
137+
make pack
138+
env:
139+
GO_VERSION: ${{ env.GO_VERSION }}
138140
APP_PEM: ${{ secrets.APP_PEM }}
139141
APP_ID: ${{ secrets.APP_ID }}
142+
CI_READ_COMMON: ${{ secrets.AUTHZCACHE_TO_COMMON }}

0 commit comments

Comments
 (0)