Skip to content

Commit

Permalink
Merge pull request #27 from epics-containers/new-ci
Browse files Browse the repository at this point in the history
update to new CI
  • Loading branch information
gilesknap authored Jan 20, 2024
2 parents 53bbe21 + f3fbce3 commit b326ca4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 79 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/build.sh

This file was deleted.

61 changes: 27 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
permissions:
contents: read
packages: write
env:
CACHE: /tmp/.buildx-cache
strategy:
fail-fast: false
max-parallel: 1 # take advantage of caching
matrix:
target: [developer, runtime]
architecture: [linux]
include:
- architecture: linux
os: ubuntu-latest
- os: ubuntu-latest
platform: linux/amd64

runs-on: ${{ matrix.os }}
Expand All @@ -28,52 +28,45 @@ jobs:
with:
submodules: recursive

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: ${{ env.CACHE }}
key: ${{ runner.os }}-${{ matrix.architecture }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.architecture }}-buildx-
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Docker Build Script
env:
ARCH: ${{ matrix.architecture }}
PLATFORM: ${{ matrix.platform }}
TAG: ${{ github.ref_name }}
PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
CACHE: ${{ env.CACHE }}
run: .github/workflows/build.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Upload schema as artifact
uses: actions/upload-artifact@v3
- name: Build image
uses: docker/build-push-action@v5
with:
name: ioc-schema
path: ibek.ioc.schema.json
context: .
file: Dockerfile
push: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
build-args: TARGET_ARCHITECTURE=${{ matrix.architecture }}
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-${{ matrix.architecture }}-${{ matrix.target }}:${{ github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

release:
# Release on tag push - publish ioc schema
needs: [build-push-images]
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
runs-on: ubuntu-latest

# this job runs in the (linux) developer container we just made
container:
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-linux-developer:${{ github.ref_name }}

steps:
- uses: actions/download-artifact@v3
with:
name: ioc-schema
path: ./
- name: generate-schema
run: |
ibek ioc generate-schema --output ibek.ioc.schema.json
# TODO add back in some tests that run INSIDE the container

- name: Github Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
Expand Down

0 comments on commit b326ca4

Please sign in to comment.