Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
chore: Add distro to e2e (#147)
Browse files Browse the repository at this point in the history
* Update snapshot build

* Fix

* Fix

* Fix

* Add fluence-cli to tests

* Fix

* Debug

* fix

* Use debug branch

* Fix

* Use main
  • Loading branch information
nahsi committed Jun 9, 2023
1 parent eac20b6 commit c7a0b75
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 56 deletions.
48 changes: 26 additions & 22 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -89,47 +93,47 @@ 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 }}
org.opencontainers.image.revision=${{ github.sha }}
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 }}
org.opencontainers.image.revision=${{ github.sha }}
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 }}
Expand All @@ -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 }}
Expand All @@ -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 changes: 82 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/snapshot.yml

This file was deleted.

0 comments on commit c7a0b75

Please sign in to comment.