Skip to content

Commit b870712

Browse files
committed
build: fix it for alpine
1 parent ba3868c commit b870712

File tree

2 files changed

+57
-7
lines changed

2 files changed

+57
-7
lines changed

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,40 @@ jobs:
133133
version: v9.1.0
134134
verbose: true
135135
token: ${{ secrets.CODECOV_TOKEN }}
136+
137+
run-alpine:
138+
runs-on: ubuntu-latest
139+
container: alpine:latest
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v4.2.2
143+
with:
144+
submodules: "true"
145+
- name: Install deps
146+
run: |
147+
apk add git
148+
- name: Upload coverage to Codecov (script)
149+
uses: ./
150+
with:
151+
files: ./coverage/script/coverage-final.json
152+
flags: script-${{ matrix.os }}
153+
name: codecov-script
154+
verbose: true
155+
token: ${{ secrets.CODECOV_TOKEN }}
156+
- name: Upload coverage to Codecov (demo)
157+
uses: ./
158+
with:
159+
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
160+
flags: demo-${{ matrix.os }}
161+
name: codecov-demo
162+
verbose: true
163+
token: ${{ secrets.CODECOV_TOKEN }}
164+
- name: Upload coverage to Codecov (version)
165+
uses: ./
166+
with:
167+
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
168+
flags: version-${{ matrix.os }}
169+
name: codecov-version
170+
version: v9.1.0
171+
verbose: true
172+
token: ${{ secrets.CODECOV_TOKEN }}

action.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,33 @@ branding:
175175
runs:
176176
using: "composite"
177177
steps:
178+
- name: Detect shell
179+
shell: sh
180+
run: |
181+
if [ -f /etc/os-release ]; then
182+
. /etc/os-release
183+
if [ "$ID" = "alpine" ]; then
184+
echo "CC_SHELL=ash" >> "$GITHUB_ENV"
185+
else
186+
echo "CC_SHELL=bash" >> "$GITHUB_ENV"
187+
fi
188+
else
189+
echo "CC_SHELL=bash" >> "$GITHUB_ENV"
190+
fi
178191
- name: Action version
179-
shell: bash
192+
shell: ${{ env.CC_SHELL }}
180193
run: |
181194
CC_ACTION_VERSION=$(cat ${GITHUB_ACTION_PATH}/src/version)
182195
echo -e "\033[0;32m==>\033[0m Running Action version $CC_ACTION_VERSION"
183196
- name: Set safe directory
184197
if: ${{ inputs.disable_safe_directory != 'true' }}
185-
shell: bash
198+
shell: ${{ env.CC_SHELL }}
186199
run: |
187200
git config --global --add safe.directory "${{ github.workspace }}"
188201
git config --global --add safe.directory "$GITHUB_WORKSPACE"
189202
190203
- name: Set fork
191-
shell: bash
204+
shell: ${{ env.CC_SHELL }}
192205
run: |
193206
CC_FORK="false"
194207
if [ -n "$GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FULL_NAME" ] && [ "$GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FULL_NAME" != "$GITHUB_REPOSITORY" ];
@@ -216,7 +229,7 @@ runs:
216229
CC_USE_OIDC: ${{ inputs.use_oidc }}
217230

218231
- name: Get and set token
219-
shell: bash
232+
shell: ${{ env.CC_SHELL }}
220233
run: |
221234
if [ "${{ inputs.use_oidc }}" == 'true' ] && [ "$CC_FORK" != 'true' ];
222235
then
@@ -238,7 +251,7 @@ runs:
238251
CC_OIDC_AUDIENCE: ${{ inputs.url || 'https://codecov.io' }}
239252

240253
- name: Override branch for forks
241-
shell: bash
254+
shell: ${{ env.CC_SHELL }}
242255
run: |
243256
if [ -z "$CC_BRANCH" ] && [ -z "$CC_TOKEN" ] && [ "$CC_FORK" == 'true' ]
244257
then
@@ -256,7 +269,7 @@ runs:
256269
GITHUB_REPOSITORY: ${{ github.repository }}
257270

258271
- name: Override commits and pr for pull requests
259-
shell: bash
272+
shell: ${{ env.CC_SHELL }}
260273
run: |
261274
if [ -z "$CC_SHA" ];
262275
then
@@ -278,7 +291,7 @@ runs:
278291

279292
- name: Upload coverage to Codecov
280293
run: ${GITHUB_ACTION_PATH}/dist/codecov.sh
281-
shell: bash
294+
shell: ${{ env.CC_SHELL }}
282295
working-directory: ${{ inputs.working-directory }}
283296
env:
284297
CC_BASE_SHA: ${{ inputs.base_sha }}

0 commit comments

Comments
 (0)