-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganize and rewrite docker images and CI
- Loading branch information
1 parent
2bfd4ed
commit 4be0e4c
Showing
16 changed files
with
496 additions
and
179 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,186 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_BASE: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
suffix: | ||
- "ubuntu" | ||
- "manylinux" | ||
platform: | ||
- linux/arm64 | ||
- linux/amd64 | ||
|
||
steps: | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
digest_key="${{ matrix.suffix }}_${{ matrix.platform }}" | ||
echo "DIGEST_KEY=${digest_key//\//-}" >> $GITHUB_OUTPUT | ||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}-${{ matrix.suffix }}" >> $GITHUB_OUTPUT | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ steps.prepare.outputs.IMAGE_NAME }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up container cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-${{ steps.prepare.outputs.DIGEST_KEY }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.prepare.outputs.DIGEST_KEY }}-buildx- | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: docker | ||
file: docker/Dockerfile-${{ matrix.suffix }} | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ steps.prepare.outputs.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
|
||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Fix Buildx cache not being cleared | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ steps.prepare.outputs.DIGEST_KEY }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
merge: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
image: | ||
- { suffix: "", original: "ubuntu" } | ||
- { suffix: "-ubuntu", original: "ubuntu" } | ||
- { suffix: "-manylinux", original: "manylinux" } | ||
|
||
steps: | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
digest_key="${{ matrix.image.original }}" | ||
echo "DIGEST_KEY=${digest_key//\//-}" >> $GITHUB_OUTPUT | ||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}${{ matrix.image.suffix }}" >> $GITHUB_OUTPUT | ||
echo "ORIGINAL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}-${{ matrix.image.original }}" >> $GITHUB_OUTPUT | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-${{ steps.prepare.outputs.DIGEST_KEY }}* | ||
merge-multiple: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ steps.prepare.outputs.IMAGE_NAME }} | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create \ | ||
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ steps.prepare.outputs.ORIGINAL_IMAGE_NAME }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ steps.prepare.outputs.IMAGE_NAME }}:${{ steps.meta.outputs.version }} | ||
smoke-test: | ||
runs-on: ubuntu-latest | ||
needs: [merge] | ||
|
||
strategy: | ||
matrix: | ||
platform: | ||
- linux/arm64 | ||
- linux/amd64 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Checkout Lite XL | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: lite-xl/lite-xl | ||
path: lite-xl | ||
|
||
- name: Configure Lite XL | ||
uses: ./ | ||
with: | ||
platform: ${{ matrix.platform }} | ||
run: | | ||
cd lite-xl | ||
meson setup --wrap-mode=forcefallback build |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2023-Present Lite XL Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.