-
-
Notifications
You must be signed in to change notification settings - Fork 19
122 lines (108 loc) · 4.36 KB
/
test-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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.8, 3.9, "3.10", "3.11"]
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*")