chore: Add distro to e2e (#147)

* Update snapshot build

* Fix

* Fix

* Fix

* Add fluence-cli to tests

* Fix

* Debug

* fix

* Use debug branch

* Fix

* Use main
This commit is contained in:
Anatolios Laskaris 2023-06-09 16:18:39 +03:00 committed by GitHub
parent eac20b6acc
commit c7a0b75aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 56 deletions

View File

@ -10,23 +10,24 @@ on:
version:
description: "version set as part of container tag"
type: string
flavour:
description: "nox flavour"
type: string
default: "minimal"
release:
description: "if triggered by release workflow"
type: boolean
default: false
outputs:
nox-image:
description: "nox snapshot image"
value: ${{ jobs.build.outputs.image }}
jobs:
build:
name: "Build and push ${{ matrix.package }}"
name: "Build and push ${{ inputs.flavour }}"
runs-on: ubuntu-latest
strategy:
matrix:
package:
- minimal
- ipfs
- rich
# for authentication to Vault with vault-action
# https://github.com/hashicorp/vault-action#jwt-with-github-oidc-tokens
permissions:
@ -36,6 +37,9 @@ jobs:
env:
RELEASE_VERSION: ${{ inputs.version }}
outputs:
image: "${{ inputs.image }}@${{ steps.docker.outputs.digest }}"
steps:
- name: Set build date
run: echo "BUILD_DATE=$(date '+%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_ENV
@ -89,16 +93,16 @@ jobs:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Build and push ${{ matrix.package }}
- name: Build and push ${{ inputs.flavour }}
id: docker
uses: docker/build-push-action@v3
with:
context: .
push: true
target: ${{ matrix.package }}
target: ${{ inputs.flavour }}
tags: |
${{ inputs.image }}:${{ matrix.package }}
${{ inputs.image }}:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
${{ inputs.image }}:${{ inputs.flavour }}
${{ inputs.image }}:${{ inputs.flavour }}_${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
@ -106,16 +110,16 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push ${{ matrix.package }} (legacy)
- name: Build and push ${{ inputs.flavour }} (legacy)
if: inputs.release
uses: docker/build-push-action@v3
with:
context: .
push: true
target: ${{ matrix.package }}
target: ${{ inputs.flavour }}
tags: |
fluencelabs/rust-peer:${{ matrix.package }}
fluencelabs/rust-peer:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
fluencelabs/rust-peer:${{ inputs.flavour }}
fluencelabs/rust-peer:${{ inputs.flavour }}_${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
@ -123,13 +127,13 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push ${{ matrix.package }}
- name: Build and push ${{ inputs.flavour }}
if: ${{ matrix.package == 'ipfs' && inputs.release }}
uses: docker/build-push-action@v3
with:
context: .
push: true
target: ${{ matrix.package }}
target: ${{ inputs.flavour }}
tags: |
${{ inputs.image }}:latest
${{ inputs.image }}:${{ env.RELEASE_VERSION }}
@ -143,7 +147,7 @@ jobs:
cache-to: type=gha,mode=max
- name: Docker Hub Description
if: ${{ matrix.package == 'ipfs' && inputs.release }}
if: ${{ inputs.flavour == 'ipfs' && inputs.release }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ env.DOCKER_USERNAME }}
@ -154,10 +158,10 @@ jobs:
if: always()
run: |
cat <<'SNAPSHOT' >> $GITHUB_STEP_SUMMARY
## nox ${{ matrix.package }}
## nox ${{ inputs.flavour }}
digest: `${{ steps.docker.outputs.digest }}`
```
${{ inputs.image }}:${{ matrix.package }}
${{ inputs.image }}:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
${{ inputs.image }}:${{ inputs.flavour }}
${{ inputs.image }}:${{ inputs.flavour }}_${{ env.RELEASE_VERSION }}
```
SNAPSHOT

82
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,82 @@
name: "e2e"
on:
pull_request:
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/container.yml"
types:
- "labeled"
- "synchronize"
- "opened"
- "reopened"
push:
branches:
- "master"
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/container.yml"
env:
DOCKER_BUILDKIT: 1
FORCE_COLOR: 1
jobs:
version:
name: "Generate snapshot id"
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
(
contains(github.event.pull_request.labels.*.name, 'e2e') &&
!github.event.pull_request.head.repo.fork
)
outputs:
id: ${{ steps.version.outputs.id }}
steps:
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
flavours:
name: "snapshot"
needs: version
strategy:
matrix:
flavour:
- ipfs
- rich
permissions:
contents: read
id-token: write
uses: ./.github/workflows/container.yml
with:
image: "docker.fluence.dev/nox-distro"
flavour: ${{ matrix.flavour }}
version: ${{ needs.version.outputs.id }}
snapshot:
needs: version
permissions:
contents: read
id-token: write
uses: ./.github/workflows/container.yml
with:
image: "docker.fluence.dev/nox-distro"
flavour: minimal
version: ${{ needs.version.outputs.id }}
fluence-cli:
needs:
- snapshot
uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@main
with:
rust-peer-image: "${{ needs.snapshot.outputs.nox-image }}"

View File

@ -38,12 +38,21 @@ jobs:
publish:
if: needs.release-please.outputs.release-created
needs: release-please
strategy:
matrix:
flavour:
- minimal
- ipfs
- rich
permissions:
contents: read
id-token: write
uses: ./.github/workflows/container.yml
with:
version: ${{ needs.release-please.outputs.version }}
flavour: ${{ matrix.flavour }}
release: true
update-release:

View File

@ -1,34 +0,0 @@
name: "snapshot"
on:
pull_request:
paths-ignore:
- "!**.md"
push:
branches:
- "main"
env:
DOCKER_BUILDKIT: 1
FORCE_COLOR: 1
jobs:
version:
name: "Generate snapshot id"
runs-on: ubuntu-latest
outputs:
id: ${{ steps.version.outputs.id }}
steps:
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
snapshot:
needs: version
permissions:
contents: read
id-token: write
uses: ./.github/workflows/container.yml
with:
image: "docker.fluence.dev/distro"
version: ${{ needs.version.outputs.id }}