forked from mehah/otclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GHA: Update Docker and Ubuntu workflows (mehah#659)
- Remove duplicated entry from editorconfig (again, don't know why it got back after PR that fixed this) - Added entry for cmake files on editorconfig - Removed not used GitVersion - Update ubuntu build workflow (Removed ccache that will not work with UNITY and PCH) - Disabled UNITY and PCH for debug images and enabled more warning flags (Show build warning on PR changes) - Update docker workflow to use newer version (Using newer versions of the actions helped cleaning the workflow, now it is smaller and easier to understand) - Do not upload artifacts when building PR as it failing and we need to re-run the build Signed-off-by: Renato Foot <[email protected]>
- Loading branch information
Showing
6 changed files
with
45 additions
and
149 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
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 |
---|---|---|
|
@@ -5,8 +5,11 @@ on: | |
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
branches: [ $default-branch ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
docker: | ||
|
@@ -17,63 +20,31 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@main | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2.1.0 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: docker/[email protected] | ||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
file: Dockerfile | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.gitversion.outputs.semVer }} | ||
cache-from: type=gha, scope=${{ github.workflow }} | ||
cache-to: type=gha, scope=${{ github.workflow }} | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
if: ${{ github.event_name == 'push' }} | ||
uses: docker/[email protected] | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.gitversion.outputs.semVer }} | ||
cache-from: type=gha, scope=${{ github.workflow }} | ||
cache-to: type=gha, scope=${{ github.workflow }} | ||
|
||
- name: Image digest | ||
if: ${{ github.event_name == 'push' }} | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
# # Temp fix | ||
# # https://github.com/docker/build-push-action/issues/252 | ||
# # https://github.com/moby/buildkit/issues/1896 | ||
# - name: Move cache | ||
# run: | | ||
# rm -rf /tmp/.buildx-cache | ||
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
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
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