Skip to content

Commit

Permalink
Update ci-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXMushroom63 authored Dec 4, 2023
1 parent efc8709 commit 8d189d2
Showing 1 changed file with 4 additions and 98 deletions.
102 changes: 4 additions & 98 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ jobs:
EOF
- name: Install Dependencies
run: npm ci
# - name: Lint
# run: |
# npm run test:lint -- --quiet --output-file test-results/eslint/results.xml --format junit
# - name: Store Lint Results
# uses: actions/upload-artifact@v3
# with:
# name: lint-output
# path: ./test-results/*
- name: Cache node_modules
id: cache-nodemodules
uses: actions/cache@v3
Expand All @@ -68,29 +60,8 @@ jobs:
path:
static/microbit
key: ${{ runner.os }}-microbit-${{ hashFiles('package-lock.json') }}
test-unit:
needs: setup
runs-on: ubuntu-latest
env:
JEST_JUNIT_OUTPUT_NAME: unit-results.xml
JEST_JUNIT_OUTPUT_DIR: test-results/unit
steps:
- uses: actions/checkout@v4
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path:
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Run Unit Tests
run: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov --maxWorkers="2"
- name: Store Unit Test Results
uses: actions/upload-artifact@v3
with:
name: unit-test-output
path: ./test-results/*
build:
needs: [setup, test-unit]
needs: [setup]
env:
NODE_OPTIONS: --max-old-space-size=4000
DETECT_CHROMEDRIVER_VERSION: "true"
Expand Down Expand Up @@ -145,75 +116,10 @@ jobs:
with:
name: dist-output
path: ./dist
test-integration:
needs: build
runs-on: ubuntu-latest
env:
JEST_JUNIT_OUTPUT_NAME: results.txt
JEST_JUNIT_OUTPUT_DIR: test-results/integration
steps:
- uses: actions/checkout@v4
- name: Install Chrome Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
- name: Retrieve npm dependencies
uses: actions/cache@v3
with:
path:
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Retrieve Build
uses: actions/cache@v3
with:
path:
./build
key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json') }}
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- run: |
echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }}
${{ steps.setup-chrome.outputs.chrome-path }} --version
- name: Run Integration Tests
run: npm run test:integration -- --reporters="default" --reporters="jest-junit"
- name: Store Integration Test Results
uses: actions/upload-artifact@v3
with:
name: integration-test-output
path: ./test-results/*
deploy-npm:
needs: [test-integration, test-unit]
if: ${{ startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/hotfix') || startsWith(github.ref, 'refs/heads/beta') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Retrieve npm dependencies
uses: actions/cache@v3
with:
path:
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Retrieve Dist Directory
uses: actions/cache@v3
with:
path:
./dist
key: ${{ runner.os }}-dist-${{ hashFiles('package-lock.json') }}
- run: |
if [[ ${{contains(github.ref, 'hotfix')}} ]]; then
sed -e "s|hotfix/REPLACE|${{ github.ref_name }}|" --in-place release.config.js
fi
- name: Semantic Release

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --no -- semantic-release

deploy-gh-pages:
needs: [test-integration, test-unit]
if: ${{ startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/hotfix') || startsWith(github.ref, 'refs/heads/beta') }}
needs: [build]
if: ${{ startsWith(github.ref, 'refs/heads/develop') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 8d189d2

Please sign in to comment.