Update deps and move to event #1249
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: Test Build ACARS Hub Typescript | |
# FIXME: Can we not build either job if stuff has been unchanged since last commit for that job? | |
# FIXME: Use branch name for tagging docker build | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- acarshub-typescript/** | |
- Dockerfile.acarshub | |
- Dockerfile.acarshub-nextgen | |
- rootfs/** | |
- .github/workflows/test-pr.yml | |
- version-nextgen | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Pull koalaman/shellcheck:stable Image | |
run: docker pull koalaman/shellcheck:stable | |
- name: Run Shellcheck against shell scripts | |
run: | | |
find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v -E '\/(.git\/|\S+.MD|\S+.md|retired_scripts\/|acarshub-typescript\/node_modules\/)' | |
docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v -E '\/(.git\/|\S+.MD|\S+.md|retired_scripts\/|acarshub-typescript\/node_modules\/)') | |
# docker run --rm -i -v "$PWD:/mnt" koalaman/shellcheck:stable $(find . -type f -exec grep -m1 -l -E '^#!.*execline.*' {} \; | grep -v '/.git/') | |
markdownlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Pull markdownlint/markdownlint:latest Image | |
run: docker pull markdownlint/markdownlint:latest | |
- name: Run markdownlint against *.md files | |
run: docker run --rm -i -v "$(pwd)":/workdir --workdir /workdir markdownlint/markdownlint:latest -r ~MD013,~MD007 $(find . -type f -iname '*.md' | grep -v '/.git/') | |
flake8: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y rrdtool librrd-dev | |
python -m pip install --upgrade pip | |
pip install flake8 pytest wheel | |
pip install -r $GITHUB_WORKSPACE/rootfs/webapp/requirements.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 --extend-ignore=W503,W504,E501 | |
acarshub-typescript: | |
runs-on: ubuntu-latest | |
needs: [hadolint, shellcheck, flake8] | |
steps: | |
# Check out our code | |
- name: Checkout | |
uses: actions/[email protected] | |
# Get version tag | |
# git log -1 : get the latest commit | |
# --format="%ct" : committer date, UNIX timestamp | |
# Then using `date` to format to YYYYMMDD format | |
- name: Get the version tag | |
run: | | |
echo "VERSION=$(sed '1!d' ./version-nextgen)" >> $GITHUB_ENV | |
# Show version tag | |
- name: Show version tag | |
run: | | |
echo "ACARS Hub Version: ${{ env.VERSION }}" | |
- name: Build ACARSHub typescript test | |
working-directory: ./acarshub-typescript | |
run: | | |
set -xe | |
npm install | |
sed -i 's/Pre-Release/ACARS Hub NextGen Pre-Release: ${{ env.VERSION }} Build ${{ github.run_number }}/' ./src/helpers/menu.ts | |
npm run build | |
mkdir -p ./webapp/static/images | |
mkdir -p ./webapp/static/js | |
mkdir -p ./webapp/static/sounds | |
mkdir -p ./webapp/templates | |
cp -r ./dist/static/images ./webapp/static/ | |
cp -r ./dist/static/sounds ./webapp/static/ | |
cp -r ./dist/static/js ./webapp/static/ | |
mv ./dist/static/index.html ./webapp/templates/ | |
tar cvfz webapp.tar.gz ./webapp | |
cp webapp.tar.gz ../webapp.tar.gz | |
- name: Save webapp.tar.gz | |
uses: actions/[email protected] | |
with: | |
name: webapp | |
path: | | |
./webapp.tar.gz | |
hadolint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Pull hadolint/hadolint:latest Image | |
run: docker pull hadolint/hadolint:latest | |
- name: Run hadolint against Dockerfiles | |
run: docker run --rm -i -v "$PWD":/workdir --workdir /workdir --entrypoint hadolint hadolint/hadolint $(find . -type f -iname "Dockerfile*") |