Skip to content

Add support for DEBUG_ENTRYPOINT and DISABLE_COLORS envs in tshock image #22

Add support for DEBUG_ENTRYPOINT and DISABLE_COLORS envs in tshock image

Add support for DEBUG_ENTRYPOINT and DISABLE_COLORS envs in tshock image #22

Workflow file for this run

name: CI
on:
push:
branches:
- develop
- main
workflow_dispatch:
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
id: node
with:
node-version: 20.11.1
- name: Send Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' }}
id: slack
with:
fields: |
{STATUS}
{REF}
Node.js: ${{ steps.node.outputs.node-version }}
Hadolint issues: Checking...
Prettier issues: Checking...
status: in-progress
- name: Enable corepack
run: corepack enable
- name: Install Prettier
run: yarn global add prettier
- name: Lint using Prettier
run: prettier --check . || true
- name: Output Prettier results
id: prettier
run: echo "issues=$(prettier --list-different . | wc -l)" >> $GITHUB_OUTPUT
- name: Lint using Hadolint (official)
uses: hadolint/[email protected]
id: hadolint-official
with:
dockerfile: ./official/Dockerfile
no-fail: true
- name: Lint using Hadolint (tshock)
uses: hadolint/[email protected]
id: hadolint-tshock
with:
dockerfile: ./tshock/Dockerfile
no-fail: true
- name: Output Hadolint results
id: hadolint
run: |
official_issues="$(echo '${{ steps.hadolint-official.outputs.results }}' | sed '/^$/d' | sed '$!N; /^\n$/D' | wc -l)"
tshock_issues="$(echo '${{ steps.hadolint-tshock.outputs.results }}' | sed '/^$/d' | sed '$!N; /^\n$/D' | wc -l)"
echo "official-issues=$official_issues" >> $GITHUB_OUTPUT
echo "tshock-issues=$tshock_issues" >> $GITHUB_OUTPUT
echo "issues=$((official_issues + tshock_issues))" >> $GITHUB_OUTPUT
- name: Check results
run: |
hadolint_official_issues="${{ steps.hadolint.outputs.official-issues }}"
hadolint_tshock_issues="${{ steps.hadolint.outputs.tshock-issues }}"
hadolint_issues="${{ steps.hadolint.outputs.issues }}"
prettier_issues="${{ steps.prettier.outputs.issues }}"
echo "Hadolint issues (official): $hadolint_official_issues"
echo "Hadolint issues (tshock): $hadolint_tshock_issues"
echo "Total Hadolint issues: $((hadolint_official_issues + hadolint_tshock_issues))"
echo "Total Prettier issues: $prettier_issues"
exit_code=1
if [ "$prettier_issues" = '0' ] && [ "$hadolint_official_issues" = '0' ] && [ "$hadolint_tshock_issues" = '0' ]; then
exit_code=0
fi
exit "$exit_code"
- name: Update Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' && always() }}
with:
fields: |
{STATUS}
{REF}
Node.js: ${{ steps.node.outputs.node-version }}
Hadolint issues: ${{ steps.hadolint.outputs.issues || 'Skipped' }}
Prettier issues: ${{ steps.prettier.outputs.issues || 'Skipped' }}
status: ${{ job.status }}
timestamp: ${{ steps.slack.outputs.slack-timestamp }}
test:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Send Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' }}
id: slack
with:
fields: |
{STATUS}
{REF}
Passed Bats tests: Testing...
status: in-progress
- name: Install Bats
run: |
sudo apt-get update
sudo apt-get install -y bats
- name: Test using Bats
id: bats
run: |
output="$(bats ./entrypoint/)"
tests_passed="$(echo "$output" | grep -c '^ok')"
tests_total="$(bats -c ./entrypoint/)"
echo "$output"
echo "output=$bats_output" >> $GITHUB_OUTPUT
echo "tests-passed=$tests_passed" >> $GITHUB_OUTPUT
echo "tests-total=$tests_total" >> $GITHUB_OUTPUT
- name: Check results
run: |
tests_passed="${{ steps.bats.outputs.tests-passed }}"
tests_total="${{ steps.bats.outputs.tests-total }}"
echo "Passed Bats tests: $tests_passed"
echo "Total Bats tests: $tests_total"
exit_code=1
if [ "$tests_passed" = "$tests_total" ]; then
exit_code=0
fi
exit "$exit_code"
- name: Update Slack notification
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' && always() }}
with:
fields: |
{STATUS}
{REF}
Passed Bats tests: ${{ steps.bats.outputs.tests-passed || '-' }} / ${{ steps.bats.outputs.tests-total || '-' }}
status: ${{ job.status }}
timestamp: ${{ steps.slack.outputs.slack-timestamp }}