ci(rust): fix cargo tarpaulin error #1122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# | |
# .github/woorkflows/gh-actions.yml | |
# | |
# https://github.com/reviewdog/action-actionlint | |
name: GitHub Action Workflow | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
stage1: | |
name: Change Check | |
runs-on: 'ubuntu-latest' | |
outputs: | |
docs_changed: ${{ steps.check_file_changed.outputs.docs_changed }} | |
steps: | |
- name: Checkout Repo | |
id: checkout-repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Get Change List | |
id: check_file_changed | |
run: | | |
# Diff HEAD with the previous commit then output to stdout. | |
printf "=== Which files changed? ===\n" | |
GIT_DIFF="$(git diff --name-only HEAD^ HEAD)" | |
printf "%s\n" "${GIT_DIFF}" | |
printf "\n" | |
# Check if the files are present in the changed file list (added, modified, deleted) then output to stdout. | |
HAS_DIFF=false | |
printf "=== Which Golang files changed? ===\n" | |
if printf "%s\n" "${GIT_DIFF}" | grep -E '^.github/workflows/.*[.]yml$'; then | |
HAS_DIFF=true | |
fi | |
printf "\n" | |
# Did Golang files change? | |
printf "=== Did Golang files change? ===\n" | |
printf "%s\n" "${HAS_DIFF}" | |
printf "\n" | |
# Set the output named "docs_changed" | |
printf "%s=%s\n" "docs_changed" "${HAS_DIFF}" >> "${GITHUB_OUTPUT}" | |
stage2: | |
name: GitHub Action Checks | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
runs-on: "${{ matrix.os }}" | |
needs: | |
- stage1 | |
if: needs.stage1.outputs.docs_changed == 'True' | |
steps: | |
- name: Checkout Repo | |
id: checkout-repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Set up Go (using latest version) | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 'stable' | |
- name: Show Go version | |
id: go-version-check | |
run: | | |
go version | |
- name: Install Tools | |
id: install-tools | |
run: | | |
go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest | |
go install github.com/rhysd/actionlint/cmd/actionlint@latest | |
sudo apt install -y shellcheck | |
- name: Reviewdog Version Checks | |
id: version-check-reviewdog | |
run: | | |
reviewdog --version | |
- name: Actionlint Version Checks | |
id: version-check-actionlint | |
run: | | |
{ | |
printf "Actionlint Version:\n" | |
actionlint --version | |
printf "\n" | |
} | tee -a "${GITHUB_STEP_SUMMARY}" | |
- name: Analyzing the code with actionlint | |
id: actionlint | |
run: |- | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
for f in ./.github/workflows/*yml; do | |
{ | |
printf "Running: actionlint %s\n" "${f}" | |
tee /tmp/actionlint.out < <(actionlint -oneline "${f}") | |
printf "\n" | |
} | tee -a "${GITHUB_STEP_SUMMARY}" | |
reviewdog -efm="%f:%l:%c: %m" -name="actionlint" -reporter=github-pr-check < /tmp/actionlint.out | |
done |