Skip to content

Commit 8bf1ad5

Browse files
author
Mohammad Yasin Habibzade
committed
Feat: added github workflow files
1 parent 48779ac commit 8bf1ad5

14 files changed

Lines changed: 778 additions & 0 deletions

.github/workflows/axe.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Axe accessibility testing
2+
3+
on:
4+
# if you want to run this on every push uncomment the following lines
5+
# push:
6+
# branches:
7+
# - master
8+
# - main
9+
# pull_request:
10+
# branches:
11+
# - master
12+
# - main
13+
workflow_dispatch:
14+
inputs:
15+
url:
16+
description: "URL to be checked (e.g.: blog/)"
17+
required: false
18+
19+
env:
20+
URL: ""
21+
22+
jobs:
23+
check:
24+
# available images: https://github.com/actions/runner-images#available-images
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout 🛎️
28+
uses: actions/checkout@v4
29+
- name: Setup Ruby
30+
uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: "3.2.2"
33+
bundler-cache: true
34+
- name: Update _config.yml ⚙️
35+
uses: fjogeleit/yaml-update-action@main
36+
with:
37+
commitChange: false
38+
valueFile: "_config.yml"
39+
changes: |
40+
{
41+
"giscus.repo": "${{ github.repository }}",
42+
"baseurl": ""
43+
}
44+
- name: Install and Build 🔧
45+
run: |
46+
sudo apt-get update && sudo apt-get install -y imagemagick
47+
pip3 install --upgrade jupyter
48+
export JEKYLL_ENV=production
49+
bundle exec jekyll build
50+
- name: Purge unused CSS 🧹
51+
run: |
52+
npm install -g purgecss
53+
purgecss -c purgecss.config.js
54+
- name: Get Chromium version 🌐
55+
# https://github.com/GoogleChromeLabs/chrome-for-testing?tab=readme-ov-file#other-api-endpoints
56+
run: |
57+
CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1)
58+
echo "Chromium version: $CHROMIUM_VERSION"
59+
echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV
60+
- name: Setup Chrome 🌐
61+
id: setup-chrome
62+
uses: browser-actions/setup-chrome@v1
63+
with:
64+
chrome-version: ${{ env.CHROMIUM_VERSION }}
65+
- name: Install chromedriver 🚗
66+
run: |
67+
npm install -g chromedriver@$CHROMIUM_VERSION
68+
- name: Run axe 🪓
69+
# https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli
70+
run: |
71+
npm install -g @axe-core/cli
72+
npm install -g http-server
73+
http-server _site/ &
74+
axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check for broken links on site
2+
3+
on:
4+
workflow_run:
5+
workflows: [Deploy site]
6+
types: [completed]
7+
8+
jobs:
9+
check-links-on-site:
10+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
# available images: https://github.com/actions/runner-images#available-images
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout 🛎️
16+
uses: actions/checkout@v4
17+
- name: Setup Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: "3.2.2"
21+
bundler-cache: true
22+
- name: Update _config.yml ⚙️
23+
uses: fjogeleit/yaml-update-action@main
24+
with:
25+
commitChange: false
26+
valueFile: "_config.yml"
27+
changes: |
28+
{
29+
"giscus.repo": "${{ github.repository }}",
30+
"baseurl": ""
31+
}
32+
- name: Install and Build 🔧
33+
run: |
34+
sudo apt-get update && sudo apt-get install -y imagemagick
35+
pip3 install --upgrade jupyter
36+
export JEKYLL_ENV=production
37+
bundle exec jekyll build
38+
- name: Purge unused CSS 🧹
39+
run: |
40+
npm install -g purgecss
41+
purgecss -c purgecss.config.js
42+
- name: Link Checker 🔗
43+
uses: lycheeverse/lychee-action@v1.9.0
44+
with:
45+
fail: true
46+
# only check local links
47+
args: --offline --remap '_site(/?.*)/assets/(.*) _site/assets/$2' --verbose --no-progress '_site/**/*.html'

.github/workflows/broken-links.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check for broken links
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths:
9+
- "assets/**"
10+
- "**.html"
11+
- "**.js"
12+
- "**.liquid"
13+
- "**/*.md"
14+
- "**.yml"
15+
- "!.github/workflows/axe.yml"
16+
- "!.github/workflows/deploy-docker-tag.yml"
17+
- "!.github/workflows/deploy-image.yml"
18+
- "!.github/workflows/docker-slim.yml"
19+
- "!.github/workflows/lighthouse-badger.yml"
20+
- "!.github/workflows/prettier.yml"
21+
- "!lighthouse_results/**"
22+
pull_request:
23+
branches:
24+
- master
25+
- main
26+
paths:
27+
- "assets/**"
28+
- "**.html"
29+
- "**.js"
30+
- "**.liquid"
31+
- "**/*.md"
32+
- "**.yml"
33+
- "!.github/workflows/axe.yml"
34+
- "!.github/workflows/deploy-docker-tag.yml"
35+
- "!.github/workflows/deploy-image.yml"
36+
- "!.github/workflows/docker-slim.yml"
37+
- "!.github/workflows/lighthouse-badger.yml"
38+
- "!.github/workflows/prettier.yml"
39+
- "!lighthouse_results/**"
40+
41+
jobs:
42+
link-checker:
43+
runs-on: ubuntu-latest
44+
# only run on the main repo
45+
if: github.repository == 'alshedivat/al-folio'
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Link Checker 🔗
50+
uses: lycheeverse/lychee-action@v2.1.0
51+
with:
52+
fail: true
53+
# removed md files that include liquid tags
54+
args: --user-agent 'curl/7.54' --exclude-path README.md --exclude-path _pages/404.md --exclude-path _pages/blog.md --exclude-path _posts/2018-12-22-distill.md --exclude-path _posts/2023-04-24-videos.md --exclude-path _books/the_godfather.md --verbose --no-progress './**/*.md' './**/*.html'

.github/workflows/codeql.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
branches: ["main"]
19+
schedule:
20+
- cron: "45 4 * * 3"
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- language: javascript-typescript
47+
build-mode: none
48+
- language: ruby
49+
build-mode: none
50+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
51+
# Use `c-cpp` to analyze code written in C, C++ or both
52+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
53+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
54+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
55+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
56+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
57+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
62+
# Initializes the CodeQL tools for scanning.
63+
- name: Initialize CodeQL
64+
uses: github/codeql-action/init@v3
65+
with:
66+
languages: ${{ matrix.language }}
67+
build-mode: ${{ matrix.build-mode }}
68+
# If you wish to specify custom queries, you can do so here or in a config file.
69+
# By default, queries listed here will override any specified in a config file.
70+
# Prefix the list here with "+" to use these queries and those in the config file.
71+
72+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
73+
# queries: security-extended,security-and-quality
74+
75+
# If the analyze step fails for one of the languages you are analyzing with
76+
# "We were unable to automatically build your code", modify the matrix above
77+
# to set the build mode to "manual" for that language. Then modify this step
78+
# to build your code.
79+
# ℹ️ Command-line programs to run using the OS shell.
80+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
81+
- if: matrix.build-mode == 'manual'
82+
shell: bash
83+
run: |
84+
echo 'If you are using a "manual" build mode for one or more of the' \
85+
'languages you are analyzing, replace this with the commands to build' \
86+
'your code, for example:'
87+
echo ' make bootstrap'
88+
echo ' make release'
89+
exit 1
90+
91+
- name: Perform CodeQL Analysis
92+
uses: github/codeql-action/analyze@v3
93+
with:
94+
category: "/language:${{matrix.language}}"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker Image CI (Upload Tag)
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
paths:
8+
- ".github/workflows/deploy-docker-tag.yml"
9+
- ".github/workflows/deploy-image.yml"
10+
- "bin/entry_point.sh"
11+
- "Dockerfile"
12+
- "Gemfile"
13+
- "Gemfile.lock"
14+
- "package.json"
15+
- "package-lock.json"
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Docker meta
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: amirpourmand/al-folio
36+
37+
- name: Login
38+
uses: docker/login-action@v3
39+
with:
40+
username: ${{ secrets.DOCKER_USERNAME }}
41+
password: ${{ secrets.DOCKER_PASSWORD }}
42+
43+
- name: Build and push
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
platforms: linux/amd64,linux/arm64/v8
48+
push: ${{ github.event_name != 'pull_request' }}
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/deploy-image.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths:
9+
- ".github/workflows/deploy-image.yml"
10+
- "bin/entry_point.sh"
11+
- "Dockerfile"
12+
- "Gemfile"
13+
- "Gemfile.lock"
14+
- "package.json"
15+
- "package-lock.json"
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
if: github.repository_owner == 'alshedivat'
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_PASSWORD }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: .
42+
push: true
43+
platforms: linux/amd64,linux/arm64/v8
44+
tags: amirpourmand/al-folio

0 commit comments

Comments
 (0)