Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI improvements #242

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: build-container

env:
GH_TOKEN: ${{ github.token }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on: workflow_call

jobs:
build-container:
runs-on: ubuntu-22.04
outputs:
json: ${{ steps.metadata.outputs.json }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: extract metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=pr
type=ref,event=branch

- name: build container
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}

- name: debug
run: echo "${{ fromJSON(steps.metadata.outputs.json).tags[0] }}"

build-willow:
uses: ./.github/workflows/build-willow.yml
needs: build-container
with:
container-image: ${{ fromJSON(needs.build-container.outputs.json).tags[0] }}
Original file line number Diff line number Diff line change
@@ -1,65 +1,27 @@
---
name: build_container

name: build-willow

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on:
pull_request:
push:
tag:
- '*'
workflow_call:
inputs:
container-image:
required: true
type: string

jobs:
build_container:
runs-on: ubuntu-22.04
outputs:
json: ${{ steps.metadata.outputs.json }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: extract metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=pr
type=ref,event=branch

- name: build container
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}

- name: debug
run: echo "${{ fromJSON(steps.metadata.outputs.json).tags[0] }}"

build-willow-dist:
strategy:
matrix:
device:
- ESP32_S3_BOX
- ESP32_S3_BOX_LITE
runs-on: ubuntu-22.04
needs: build_container
container:
image: ${{ fromJSON(needs.build_container.outputs.json).tags[0] }}
image: ${{ inputs.container-image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand All @@ -77,7 +39,7 @@ jobs:
- name: checkout
uses: actions/checkout@v3
- name: debug
run: echo ${{ needs.build_container.outputs.tags }}
run: echo ${{ inputs.container-tag }}
- name: ls -al
run: ls -al
- name: ls -al /
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: meta

env:
GH_TOKEN: ${{ github.token }}

on:
pull_request:
push:

jobs:
trigger_workflow:
name: trigger workflow based on changed files
runs-on: ubuntu-22.04
outputs:
container_any_changed: ${{ steps.changed_files_yaml.outputs.container_any_changed }}
image_any_changed: ${{ steps.changed_files_yaml.outputs.image_any_changed }}
steps:
- uses: actions/checkout@v3
with:
# fetch full history to be able to gather changed files in all new commits
fetch-depth: 0

- uses: tj-actions/changed-files@v37
id: changed_files_yaml
with:
files_yaml: |
container:
- '.github/workflows/build-container.yml'
- 'Dockerfile'
- 'container.gitconfig'
- 'utils.sh'
image:
- 'CMakeLists.txt'
- 'main/**'
- 'partitions_willow.csv'
- 'sdkconfig.willow'
- 'spiffs/**'


build_container:
if: ${{ needs.trigger_workflow.outputs.container_any_changed == 'true' }}
uses: ./.github/workflows/build-container.yml
needs: trigger_workflow

build_willow:
if: ${{ needs.trigger_workflow.outputs.container_any_changed == 'false' && needs.trigger_workflow.outputs.image_any_changed == 'true' }}
uses: ./.github/workflows/build-willow.yml
needs: trigger_workflow
with:
container-image: ghcr.io/toverainc/willow:main
58 changes: 0 additions & 58 deletions patches/esp-adf-multinet6.patch

This file was deleted.