Skip to content

Commit

Permalink
CI improvements and fixes (#23)
Browse files Browse the repository at this point in the history
* Fix CodeQL

* Add Python to code scanning

* Add GitHub Super-Linter, fix linting error in Dockerfile
  • Loading branch information
GoetzGoerisch authored Dec 8, 2020
1 parent 9000b2e commit aa255da
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 27 deletions.
40 changes: 16 additions & 24 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
FROM alpine:latest as build-env

RUN apk update && \
apk upgrade && \
apk --update add \
gcc \
g++ \
cmake \
bash \
git \
make \
python3 \
&& \
rm -rf /var/cache/apk/*
FROM alpine:3 as build-env

RUN apk --no-cache add \
bash=~5.0.17 \
cmake=~3.17.2 \
gcc=~9.3.0 \
g++=~9.3.0 \
git=~2.26.2 \
make=~4.3 \
python3=~3.8.5

RUN mkdir /install

ARG BUILD_TYPE=Debug

COPY Sample-Server /src/Sample-Server

RUN mkdir -p /build && \
cd /build && \
cmake /src/Sample-Server/.github/ \
WORKDIR /build
RUN cmake /src/Sample-Server/.github/ \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX:PATH=/install &&\
-DCMAKE_INSTALL_PREFIX:PATH=/install /build &&\
cmake --build .

FROM alpine:latest as runtime
RUN apk update && \
apk upgrade && \
apk --update add \
libstdc++ && \
rm -rf /var/cache/apk/*
FROM alpine:3 as runtime
RUN apk --no-cache add \
libstdc++=~9.3.0
COPY --from=build-env /install/bin /app

EXPOSE 4840
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
Expand All @@ -39,7 +39,6 @@ jobs:
- name: Checkout Sample-Server
uses: actions/checkout@v2
with:
path: Sample-Server
submodules: recursive

# Initializes the CodeQL tools for scanning.
Expand All @@ -51,11 +50,12 @@ jobs:
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Build server with dependencies
run: |
mkdir -p build
cd build
cmake ../Sample-Server/.github/ -DCMAKE_INSTALL_PREFIX:PATH=${{ env.CMAKE_INSTALL_PREFIX }}
cmake ../.github/ -DCMAKE_INSTALL_PREFIX:PATH=${{ env.CMAKE_INSTALL_PREFIX }}
cmake --build .
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
55 changes: 55 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore: [main]
# Remove the line above to run when pushing to master
pull_request:
branches: [main, develop]

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v3
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit aa255da

Please sign in to comment.