2021-07-14 01:22:00 +08:00
|
|
|
name: Script unit tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
2021-10-30 03:48:21 +08:00
|
|
|
- "**.sh"
|
|
|
|
- "**.bats"
|
2021-07-14 01:22:00 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2021-10-30 03:48:21 +08:00
|
|
|
paths:
|
|
|
|
- "**.sh"
|
|
|
|
- "**.bats"
|
2021-07-14 01:22:00 +08:00
|
|
|
|
2022-03-02 07:03:39 +08:00
|
|
|
permissions:
|
|
|
|
actions: none
|
|
|
|
checks: none
|
|
|
|
contents: read
|
|
|
|
deployments: none
|
|
|
|
issues: none
|
|
|
|
packages: none
|
|
|
|
pull-requests: none
|
|
|
|
repository-projects: none
|
|
|
|
security-events: none
|
|
|
|
statuses: none
|
|
|
|
|
|
|
|
# Cancel in-progress runs for pull requests when developers push
|
|
|
|
# additional changes, and serialize builds in branches.
|
|
|
|
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
2021-07-14 01:22:00 +08:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Run script unit tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# This runs on Alpine to make sure we're testing with actual sh.
|
2022-12-01 00:51:03 +08:00
|
|
|
container: "alpine:3.17"
|
2021-07-14 01:22:00 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-03-02 07:31:32 +08:00
|
|
|
uses: actions/checkout@v3
|
2021-07-14 01:22:00 +08:00
|
|
|
|
2021-07-14 01:24:30 +08:00
|
|
|
- name: Install test utilities
|
|
|
|
run: apk add bats checkbashisms
|
|
|
|
|
|
|
|
- name: Check Bashisms
|
|
|
|
run: checkbashisms ./install.sh
|
2021-07-14 01:22:00 +08:00
|
|
|
|
|
|
|
- name: Run script unit tests
|
|
|
|
run: ./ci/dev/test-scripts.sh
|
2022-09-23 03:33:32 +08:00
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Lint shell files
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install lint utilities
|
|
|
|
run: sudo apt install shellcheck
|
|
|
|
|
|
|
|
- name: Lint shell files
|
|
|
|
run: ./ci/dev/lint-scripts.sh
|