Skip to content

chore: Update GitHub Actions artifact upload to v4 #172

chore: Update GitHub Actions artifact upload to v4

chore: Update GitHub Actions artifact upload to v4 #172

name: Test and Coverage
on:
push:
branches:
- development
- main
pull_request:
branches:
- main
jobs:
test-node:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Node.js dependencies
working-directory: ./SecureEncoderReact
run: npm install
- name: Run Node.js tests
working-directory: ./SecureEncoderReact
run: npm run test:coverage
- name: Upload coverage to Codecov for SecureEncoderReact
uses: codecov/codecov-action@v4.0.1
with:
files: ./SecureEncoderReact/coverage/lcov.info
flags: SecureEncoderReact
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-node:
runs-on: ubuntu-latest
needs: [test-node, test-python]
container:
image: cimg/node:20.15.0
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install Node.js dependencies
working-directory: ./SecureEncoderReact
run: |
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
- name: Build Node.js application
working-directory: ./SecureEncoderReact
run: npm run build
- name: Store artifacts
run: |
mkdir -p ~/artifacts
cp -R ./SecureEncoderReact/build ./SecureEncoderReact/dist ./SecureEncoderReact/public ~/artifacts || true
if: always()
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: node-build
path: ~/artifacts
test-python:
runs-on: ubuntu-latest
container:
image: cimg/python:3.9-node
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python dependencies
working-directory: ./SecureEncoderFlask
run: pip install -r requirements.txt
- name: Run Python tests with coverage
working-directory: ./SecureEncoderFlask
run: pytest --cov=./ --cov-report=xml --junitxml=junit.xml || ((($? == 5)) && echo 'Did not find any tests to run.')
- name: Upload coverage to Codecov for SecureEncoderFlask
uses: codecov/codecov-action@v4.0.1
with:
files: ./SecureEncoderFlask/coverage.xml
flags: SecureEncoderFlask
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Store test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: ./SecureEncoderFlask/junit.xml
deploy:
runs-on: ubuntu-latest
needs: build-node
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deploy
run: |
# Replace this with actual deployment commands
echo "Deploying the application..."