-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e11eeb
commit 5bb2b07
Showing
1 changed file
with
14 additions
and
168 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,172 +1,18 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- olt | ||
|
||
name: GitHub Actions Demo | ||
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 | ||
on: [push] | ||
jobs: | ||
build: | ||
name: Build Frontend Artifact | ||
Explore-GitHub-Actions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: ensure node installed and right version | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: frontend/node_modules | ||
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | ||
|
||
- name: install deps | ||
run: cd frontend && npm i | ||
|
||
- name: compile/build | ||
run: cd frontend && npm run build | ||
|
||
- name: upload the artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: frontend/build | ||
|
||
security-audit: | ||
name: Audit Deps | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: ensure node installed and right version | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: audit | ||
run: cd frontend && npm audit --omit=dev | ||
|
||
lint: | ||
name: 🧼 Ensure Code Style | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Node 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: frontend/node_modules | ||
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | ||
|
||
- name: Install deps | ||
run: cd frontend && npm i | ||
|
||
- name: 😂 Lint code | ||
run: cd frontend && npm run lint | ||
|
||
test: | ||
name: 🧪 Run Unit Tests | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Node 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Cache Node Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: frontend/node_modules | ||
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | ||
|
||
- name: Install deps | ||
run: cd frontend && npm i | ||
|
||
- name: Run the unit tests | ||
run: cd frontend && npm run test-ci | ||
|
||
static-analysis: | ||
name: 🔬 Run Static Code Analysis | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
security-events: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
config-file: ./.github/codeql/codeql.config.yml | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Cache Node Modules | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: frontend/node_modules | ||
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | ||
|
||
- name: Install Deps | ||
run: cd frontend && npm i | ||
|
||
- name: Build | ||
run: cd frontend && npm run build | ||
|
||
- name: Perform Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
|
||
deploy: | ||
name: 🚚 Deploy Frontend Artifact | ||
runs-on: ubuntu-latest | ||
needs: | ||
- security-audit | ||
- lint | ||
- test | ||
- static-analysis | ||
if: github.ref == 'refs/heads/olt' | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 | ||
|
||
verify: | ||
name: 🧪 Verify Successful Deployment | ||
needs: | ||
- deploy | ||
runs-on: ubuntu-latest | ||
if: success() | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Frontend Smoke Test | ||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | ||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | ||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | ||
- run: echo "🖥️ The workflow is now ready to test your code on the runner." | ||
- name: List files in the repository | ||
run: | | ||
export TEST_URL=https://bsommardahl.github.io/anyhasher/ | ||
cd frontend/e2e | ||
npm i | ||
npm run smoke | ||
ls ${{ github.workspace }} | ||
- run: echo "🍏 This job's status is ${{ job.status }}." |