ci add js #6
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
name: check | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
cla-check: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
outputs: | |
cla-signed: ${{ steps.cla-check-step.outputs.cla-signed }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: CLA check | |
id: cla-check-step | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PR_AUTHOR=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }} \ | |
| jq -r '.user.login') | |
echo "The PR author is $PR_AUTHOR" | |
EMAIL=$(git log -1 --pretty=format:'%ae') | |
echo "Commit author email: $EMAIL" | |
CLA_RESPONSE=$(curl -s "https://mooncakes.io/api/v0/cla/check?gh_username=$PR_AUTHOR&email=$EMAIL") | |
echo "CLA check response: $CLA_RESPONSE" | |
SIGNED=$(echo $CLA_RESPONSE | jq -r '.signed') | |
echo "cla-signed=$SIGNED" >> $GITHUB_ENV | |
echo "If you have any questions about the CLA result, please contact us." | |
if [ "$SIGNED" != "true" ]; then | |
echo "CLA is not signed." | |
exit 1 | |
else | |
echo "CLA is signed." | |
fi | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install | |
run: | | |
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/ubuntu_x86_64_moon_setup.sh)" | |
echo "/home/runner/.moon/bin" >> $GITHUB_PATH | |
- name: moon check | |
run: moon check | |
- name: moon test | |
run: | | |
moon test | |
moon test --target js | |
- name: moon bundle | |
run: moon bundle | |
- name: check core size | |
run: ls -alh `find ./target/bundle -name *.core` | |
- name: format diff | |
run: | | |
moon fmt | |
git diff | |
build-on-mac: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install | |
run: | | |
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/mac_intel_moon_setup.sh)" | |
echo "$HOME/.moon/bin" >> $GITHUB_PATH | |
- name: moon check | |
run: moon check | |
- name: moon test | |
run: | | |
moon test | |
moon test --target js | |
- name: moon bundle | |
run: moon bundle | |
- name: check core size | |
run: ls -alh `find ./target/bundle -name *.core` | |
- name: format diff | |
run: | | |
moon fmt | |
git diff | |
build-on-mac-bleeding: | |
runs-on: macos-14 | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install | |
run: | | |
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/bleeding/mac_m1_moon_setup.sh)" | |
echo "$HOME/.moon/bin" >> $GITHUB_PATH | |
- name: moon check | |
run: moon check | |
- name: moon test | |
run: | | |
moon test | |
moon test --target js | |
- name: moon bundle | |
run: moon bundle | |
- name: check core size | |
run: ls -alh `find ./target/bundle -name *.core` | |
- name: format diff | |
run: | | |
moon fmt | |
git diff | |
coverage-check-bleeding: | |
runs-on: macos-14 | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install | |
run: | | |
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/bleeding/mac_m1_moon_setup.sh)" | |
echo "$HOME/.moon/bin" >> $GITHUB_PATH | |
- name: moon test | |
run: moon test --enable-coverage | |
- name: moon_cove_report | |
run: moon_cove_report | |
- name: bisect_ppx report | |
run: | | |
bisect-ppx-report html | |
bisect-ppx-report summary > coverage_summary.txt | |
echo "coverage_summary=$(cat coverage_summary.txt)" >> $GITHUB_ENV | |
# Put the coverage report in the pipline output | |
cat coverage_summary.txt >> "$GITHUB_STEP_SUMMARY" | |
bisect-ppx-report coveralls codecov_report.json --service-name github --service-job-id $GITHUB_RUN_NUMBER | |
# The following is workaround for https://github.com/codecov/feedback/issues/126 | |
# See `coverage-report-upload.yml` for more info. | |
# Workaround for https://github.com/orgs/community/discussions/25220 | |
# Triggered sub-workflow is not able to detect the original commit/PR which is available | |
# in this workflow. | |
- name: Store PR number and commit SHA | |
run: | | |
echo "Storing PR number ${{ github.event.number }}" | |
echo "${{ github.event.number }}" > pr_number.txt | |
echo "Storing commit SHA ${{ github.event.pull_request.head.sha }}" | |
echo "${{ github.event.pull_request.head.sha }}" > commit_sha.txt | |
# This stores the coverage report in artifacts. The actual upload to Codecov | |
# is executed by a different workflow `coverage-report-upload.yml`. The reason for this | |
# split is because `on.pull_request` workflows don't have access to secrets. | |
- name: Store coverage report in artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codecov_report | |
path: | | |
pr_number.txt | |
commit_sha.txt | |
codecov_report.json | |
typo-check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
FORCE_COLOR: 1 | |
TYPOS_VERSION: v1.19.0 | |
steps: | |
- name: download typos | |
run: curl -LsSf https://github.com/crate-ci/typos/releases/download/$TYPOS_VERSION/typos-$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: check typos | |
run: typos | |
license-header-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check License Header | |
uses: korandoru/hawkeye@v5 |