forked from go-debos/debos
-
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.
Merge pull request #5 from eds-collabora/eds/actions_cleanup4
Eds/actions cleanup4
- Loading branch information
Showing
6 changed files
with
207 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.git |
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,200 @@ | ||
name: Build, test and deploy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
tags: [ 'v*.*.*' ] | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
~ | ||
|
||
env: | ||
DOCKERHUB_TAG: edscollabora/debos | ||
GITHUB_TAG: ghcr.io/${{ github.repository_owner }}/debos | ||
TEST_TAG: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Use cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.build-cache | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-docker- | ||
- name: Build Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: false | ||
file: docker/Dockerfile | ||
cache-from: type=local,src=/tmp/.build-cache | ||
cache-to: type=local,dest=/tmp/.build-cache,mode=max | ||
|
||
unit-test: | ||
name: Run unit tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Use cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.build-cache | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: false | ||
tags: ${{ env.TEST_TAG }}:builder | ||
file: docker/Dockerfile | ||
cache-from: type=local,src=/tmp/.build-cache | ||
load: true | ||
target: builder | ||
|
||
- name: Run unit tests | ||
run: | | ||
docker-compose -f docker/unit-tests.test.yml \ | ||
up --exit-code-from=sut | ||
env: | ||
IMAGE: ${{ env.TEST_TAG }}:builder | ||
|
||
recipe-test: | ||
name: Run recipe tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Use cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.build-cache | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: false | ||
tags: ${{ env.TEST_TAG }} | ||
file: docker/Dockerfile | ||
cache-from: type=local,src=/tmp/.build-cache | ||
load: true | ||
|
||
- name: Run test recipes on host | ||
run: | | ||
docker-compose -f docker/recipes.test.yml \ | ||
up --exit-code-from=sut | ||
env: | ||
IMAGE: ${{ env.TEST_TAG }} | ||
|
||
uml-test: | ||
name: Run UML tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Use cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.build-cache | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: false | ||
tags: ${{ env.TEST_TAG }} | ||
file: docker/Dockerfile | ||
cache-from: type=local,src=/tmp/.build-cache | ||
load: true | ||
|
||
- name: Run test recipes using UML backend | ||
run: | | ||
docker-compose -f docker/recipes-test-uml.yml \ | ||
up --exit-code-from=sut | ||
env: | ||
IMAGE: ${{ env.TEST_TAG }} | ||
|
||
publish: | ||
name: Publish | ||
needs: | ||
- unit-test | ||
- recipe-test | ||
- uml-test | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.DOCKERHUB_TAG }},${{ env.GITHUB_TAG }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Use cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.build-cache | ||
key: ${{ runner.os }}-docker-${{ github.sha }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: docker/Dockerfile | ||
cache-from: type=local,src=/tmp/.build-cache |
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 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