fixed weird stuff github did #539
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
--- | |
################################# | |
################################# | |
## GitHub Actions ## | |
################################# | |
################################# | |
name: General Workflow | |
# | |
# Documentation: | |
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions | |
# | |
############################# | |
# Start the job on all push and pull request # | |
############################# | |
on: push | |
############### | |
# Set the Job # | |
############### | |
jobs: | |
license: | |
name: License check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
################################ | |
# Install Python and its Dependencies # | |
################################ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "pip" # caching pip dependencies | |
- name: Install Python Dependencies | |
working-directory: "./Backend" | |
run: pip install -r requirements.txt | |
################################ | |
# Check copyright job # | |
################################ | |
- name: Check copyright | |
id: license_check_report | |
uses: pilosus/action-pip-license-checker@v2 | |
with: | |
requirements: "./Backend/requirements.txt" | |
fail: "StrongCopyleft" | |
totals: true | |
headers: true | |
################################ | |
# Print copyright job report # | |
################################ | |
- name: Print copyright report | |
if: always() | |
run: echo "${{ steps.license_check_report.outputs.report }}" | |
################################ | |
# Install Node and its Dependencies # | |
################################ | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
- name: Install Node Dependencies | |
working-directory: "./Frontend" | |
run: sudo npm ci | |
############################ | |
# Check npm module licenses # | |
############################ | |
- name: Install license-checker-rseidelsohn | |
run: npm install -g license-checker-rseidelsohn | |
- name: Check npm module licenses | |
run: | | |
cd ./Frontend | |
license-checker-rseidelsohn --summary --out licenses-summary.json | |
cat licenses-summary.json # Display the content | |
while IFS= read -r line; do | |
# Check if the line contains a Strong Copyleft license | |
if echo "$line" | grep -q -E '(GPL|AGPL|LGPL|CDDL|EPL)'; then | |
# Check if the line only contains Strong Copyleft license | |
if echo "$line" | grep -q -E -v '(MIT|Apache-2.0|BSD|ISC)'; then | |
echo "Error: Line contains only Strong Copyleft: $line" | |
exit 1 | |
fi | |
fi | |
done < licenses-summary.json | |
build: | |
# Name the Job | |
name: Lint Code Base and Test Code | |
# Set the agent to run on | |
runs-on: ubuntu-latest | |
################## | |
# Load all steps # | |
################## | |
steps: | |
########################## | |
# Checkout the code base # | |
########################## | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
# Full git history is needed to get a proper | |
# list of changed files within `super-linter` | |
fetch-depth: 0 | |
################################ | |
# Install Python and its Dependencies # | |
################################ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "pip" # caching pip dependencies | |
- name: Install Python Dependencies | |
working-directory: "./Backend" | |
run: pip install -r requirements.txt | |
################################ | |
# Run Linter against code base # | |
################################ | |
- name: Lint Code Base | |
uses: super-linter/super-linter@v5 | |
env: | |
VALIDATE_ALL_CODEBASE: false | |
DEFAULT_BRANCH: main | |
VALIDATE_TYPESCRIPT_ES: true | |
VALIDATE_PYTHON_BLACK: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LINTER_RULES_PATH: "../../Frontend/src/app/.eslintrc.json" | |
################################ | |
# Run Backend tests # | |
################################ | |
- name: Run Backend Tests | |
working-directory: "./Backend" | |
run: pytest --cov=app --cov-branch test | |
env: | |
TEST_STAGE: "ci" | |
PASSWORD: ${{ secrets.PASSWORD }} | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
MONGODB_URL: mongodb://localhost:27017/ | |
################################ | |
# Install Node and its Dependencies # | |
################################ | |
#- name: Set up Node | |
# uses: actions/setup-node@v4 | |
# with: | |
# node-version: "20.x" | |
# cache: "npm" | |
#- name: Install Node Dependencies | |
# working-directory: "./Frontend" | |
# run: sudo npm install | |
################################ | |
# Run Frontend tests # | |
################################ | |
#- name: Run Frontend Tests | |
# working-directory: "./Frontend" | |
# run: npm run test:prod |