diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d699a564..c4a47812 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,31 +10,65 @@ jobs: max-parallel: 4 matrix: python-version: ['3.10'] + node-version: ['18'] steps: - uses: actions/checkout@v3 - - name: Set up Python 3.10 + - uses: awalsh128/cache-apt-pkgs-action@v1.3.1 + with: + packages: libsasl2-dev python3-dev libldap2-dev libssl-dev + version: 1.0 + + # Setup python & dependencies + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install Python Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + # Build Vue frontend - - uses: actions/setup-node@v3 + - name: Set up Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 with: - node-version: '18' + node-version: ${{ matrix.node-version }} + cache: 'yarn' + cache-dependency-path: ./vue/yarn.lock + - name: Install Vue dependencies working-directory: ./vue run: yarn install + - name: Build Vue dependencies working-directory: ./vue run: yarn build - - name: Install Django dependencies + + # Build backend + - name: Cache Django collectstatic + uses: actions/cache@v2 + with: + path: ./staticfiles + key: | + ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic + + - name: Compile Django StatisFiles run: | - sudo apt-get -y update - sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev - python -m pip install --upgrade pip - pip install -r requirements.txt python3 manage.py collectstatic --noinput python3 manage.py collectstatic_js_reverse + - name: Django Testing project - run: | - pytest + run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + comment_mode: off + files: | + junit/test-results-${{ matrix.python-version }}.xml