Skip to content

Cpp clock

Cpp clock #320

Workflow file for this run

---
#
# .github/workflows/awk.yml
#
name: Awk Workflow
on: # yamllint disable-line rule:truthy
pull_request:
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 Awk files changed? ===\n"
if printf "%s\n" "${GIT_DIFF}" | grep -E '^(awk/.*[.]awk|.github/workflows/awk.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: Awk 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
- name: Set up Awk
id: setup-awk
run: |
sudo apt install -y gawk
- name: Show Awk version
id: awk-version
run: |
awk --version
- name: Checkout bats-core
id: checkout-bats-core
uses: actions/checkout@v3
with:
repository: bats-core/bats-core
path: bats-core
- name: Install Bats
id: install-bats-core
run: |
cd bats-core
sudo ./install.sh /usr/local
- name: Checkout awkunit
id: checkout-awkunit
uses: actions/checkout@v3
with:
repository: soimort/awkunit
path: awkunit
- name: Install Awk Tools
id: install-awk-tools
run: |
ls
awk_ver="gawk-$(awk --version | awk '/^GNU Awk/ { print $3 }' | tr -d ',')"
git clone http://git.savannah.gnu.org/r/gawk.git gawk
cd gawk
git checkout "${awk_ver}"
cd ../awkunit
AWKSRCPATH=../gawk make
mkdir -pv ../.lib
cp -v awkunit.so ../.lib
- name: CD to Awk Dir
id: cd-to-awk-dir
run: |
pwd
ls
cd ./awk
pwd
ls
- name: Lint Checking with Awk
id: awk-lint-run
run: |
cd ./awk
./for_each ../../.github/citools/awk/awk-lint
- name: Testing with Bats tests
id: awk-bats-run
run: |
cd ./awk
./for_each ../../.github/citools/awk/awk-bats
- name: Testing with AwkUnit
id: awk-test-run
run: |-
cd ./awk
# still trying to figure out why this is broken in CI
./for_each ../../.github/citools/awk/awk-test || true