Skip to content

Commit

Permalink
Merge pull request #3 from cdalvaro/feature/upgrade-2.2.0
Browse files Browse the repository at this point in the history
Upgrade to version 2.2.0
  • Loading branch information
cdalvaro authored Aug 28, 2022
2 parents 4a1132e + 41105c7 commit c11fba7
Show file tree
Hide file tree
Showing 19 changed files with 842 additions and 181 deletions.
62 changes: 0 additions & 62 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: cdalvaro
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

# Configuration for Dockerfile
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
# Disable all pull requests for Docker dependencies
open-pull-requests-limit: 0
18 changes: 18 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- keep-alive
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
114 changes: 114 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build and test Docker image

on:
pull_request:
branches:
- main
paths-ignore:
- "./**/*.md"
- "LICENSE"

env:
IMAGE_NAME: localhost:5000/cdalvaro/docker-nerd-fonts-patcher:${{ github.sha }}
REGISTRY_PATH: ${{ github.workspace }}/registry
CACHE_PATH: /tmp/.buildx-cache

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host

- name: Start Docker registry
run: |
docker run --rm --detach --publish 5000:5000 \
--volume ${REGISTRY_PATH}:/var/lib/registry \
--name registry registry:2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build docker-nerd-fonts-patcher image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
cache-from: |
type=local,src=${{ env.CACHE_PATH }}
ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest
cache-to: type=local,dest=${{ env.CACHE_PATH }}
push: true
tags: ${{ env.IMAGE_NAME }}

- name: Stop Docker registry
run: docker stop registry

- name: Upload Docker registry data for testing
uses: actions/upload-artifact@v3
with:
name: docker-registry-data
path: ${{ env.REGISTRY_PATH }}/

test:
name: Test
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
platform: [linux/amd64, linux/arm64, linux/arm/v7]
env:
DOCKER_CLI_EXPERIMENTAL: enabled
PLATFORM: ${{ matrix.platform }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download Docker registry data from build job
uses: actions/download-artifact@v3
with:
name: docker-registry-data
path: ${{ env.REGISTRY_PATH }}

- name: Enable Docker experimental
run: |
# Enable docker daemon experimental support.
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
# Install QEMU multi-architecture support for docker buildx.
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Start Docker registry
run: |
docker run --rm --detach --publish 5000:5000 \
--volume ${REGISTRY_PATH}:/var/lib/registry \
--name registry registry:2
sleep 10
- name: Import Docker images
run: docker pull --platform ${{ matrix.platform }} ${IMAGE_NAME}

- name: Docker inspect
run: docker buildx imagetools inspect ${IMAGE_NAME} | grep '${{ matrix.platform }}'

- name: Install ttx tool
run: sudo apt update -y && sudo apt install -y python3-fonttools fonttools

- name: Execute tests
run: bash tests/patch-test.sh
25 changes: 25 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint Code

on:
pull_request:
branches:
- main

jobs:
lint:
name: Super Linter
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Lint code base
uses: github/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_BASH: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123 changes: 123 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Publish Docker image

on:
push:
branches:
- main
paths-ignore:
- './**/*.md'
- 'LICENSE'
release:
types:
- published

env:
IMAGE_NAME: cdalvaro/docker-nerd-fonts-patcher
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
CACHE_PATH: /tmp/.buildx-docker-nerd-fonts-patcher-cache
EXTRA_REGISTRIES: ghcr.io quay.io

jobs:
metadata:
name: Metadata
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.tags }}
vcs_ref: ${{ steps.vcs_ref.outputs.vcs_ref }}
created_on: ${{ steps.created_on.outputs.created_on }}
steps:
- name: Image Tags
id: tags
run: |
IMAGE_TAG="${{ github.event.release.tag_name }}"
[ -z "${IMAGE_TAG}" ] && IMAGE_TAG='latest'
DOCKER_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}"
TAGS="${DOCKER_IMAGE}"
for registry in ${EXTRA_REGISTRIES}; do
TAGS="${TAGS},${registry}/${DOCKER_IMAGE}"
done
echo "Image Tag: '${IMAGE_TAG}'"
echo "Docker image: '${DOCKER_IMAGE}'"
echo "Tags: ${TAGS}"
echo ::set-output name=tags::${TAGS}
- name: VCS ref
id: vcs_ref
run: |
VCS_REF="${GITHUB_SHA::8}"
echo "VCS ref: ${VCS_REF}"
echo ::set-output name=vcs_ref::${VCS_REF}
- name: Created On
id: created_on
run: |
CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo "Created on: ${CREATED_ON}"
echo ::set-output name=created_on::${CREATED_ON}
- name: Dump environment
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
run: env | sort
- name: Dump GitHub context
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"

build-publish:
name: Build and publish
runs-on: ubuntu-latest
needs: metadata
if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == false
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Container Registry
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Login to Quay.io Container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}

- name: Build and publish
uses: docker/build-push-action@v3
with:
platforms: ${{ env.PLATFORMS }}
build-args: |
VCS_REF=${{ needs.metadata.outputs.vcs_ref }}
BUILD_DATE=${{ needs.metadata.outputs.created_on }}
cache-from: type=local,src=${{ env.CACHE_PATH }}
cache-to: type=local,dest=${{ env.CACHE_PATH }}
push: true
tags: ${{ needs.metadata.outputs.tags }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Default directories
in/
out/
tests/assets/
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

The following list only reflects changes made on this project. Please, refer to the Nerd Fonts [Release Notes](https://www.nerdfonts.com/releases) for the complete list of changes.
The following list only reflects changes made on this project. Please, refer to the [Nerd Fonts 2.2.0 Release Notes](https://www.nerdfonts.com/releases) for the complete list of changes.

**2.2.0**

* Upgrade Nerd Fonts to `2.2.0`
* Change Docker base image to `ubuntu:jammy-20220801`
* CI: Replace CircleCI with GitHub Actions
* CI: Improve build time

**2.1.0**

Expand Down
Loading

0 comments on commit c11fba7

Please sign in to comment.