-
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.
- Loading branch information
1 parent
b85c4e8
commit 88cce97
Showing
1 changed file
with
77 additions
and
77 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 |
---|---|---|
|
@@ -168,7 +168,8 @@ jobs: | |
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
echo "platform_pair=${platform//\//-}" >> $GITHUB_OUTPUT | ||
id: prepare | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
@@ -207,24 +208,94 @@ jobs: | |
PROJECT_VERSION=${{ needs.info.outputs.project_version }} | ||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | ||
|
||
- name: Export digest | ||
- name: Export image digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
- name: Upload image digest as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
name: digests-${{ steps.prepare.outputs.platform_pair }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
docker_image_test_build: | ||
name: "Build Tests" | ||
needs: ["info", "docker_image_build"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker image Build | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: ./Dockerfile | ||
target: tests | ||
context: . | ||
tags: pyramid:tests | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
PROJECT_VERSION=${{ needs.info.outputs.project_version }}-tests | ||
push: false | ||
outputs: type=docker | ||
|
||
- name: Export tests image | ||
run: docker save pyramid:tests -o "./pyramid-tests.tar" | ||
|
||
- name: Upload tests image as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: image-tests | ||
path: ./pyramid-tests.tar | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
tests_in_docker: | ||
name: "Tests" | ||
needs: ["docker_image_test_build"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download tests image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: image-tests | ||
|
||
- name: Load Docker image | ||
run: docker load -i "./pyramid-tests.tar" | ||
|
||
- name: Run unit tests | ||
run: | | ||
mkdir -p ./coverage && chmod 777 ./coverage | ||
docker run --rm -v ./coverage:/app/coverage -e SPOTIFY__CLIENT_ID=${{ secrets.CONFIG_SPOTIFY_CLIENT_ID }} -e SPOTIFY__CLIENT_SECRET=${{ secrets.CONFIG_SPOTIFY_CLIENT_SECRET }} pyramid:tests | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: tristiisch/PyRamid | ||
files: ./coverage/cover/result | ||
|
||
docker_image_push: | ||
name: "Push" | ||
runs-on: ubuntu-latest | ||
needs: ["info", "docker_image_build"] | ||
needs: ["info", "docker_image_build", "tests_in_docker"] | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
|
@@ -259,7 +330,7 @@ jobs: | |
docker_image_push_private: | ||
name: "Push Privates" | ||
runs-on: ubuntu-latest | ||
needs: ["info", "docker_image_build"] | ||
needs: ["info", "docker_image_build", "tests_in_docker"] | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
|
@@ -349,74 +420,3 @@ jobs: | |
--notes-file "./changelog.txt" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
docker_image_test_build: | ||
name: "Build Tests" | ||
needs: ["info", "docker_image_build"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker image Build | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: ./Dockerfile | ||
target: tests | ||
context: . | ||
tags: pyramid:tests | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
PROJECT_VERSION=${{ needs.info.outputs.project_version }}-tests | ||
push: false | ||
outputs: type=docker | ||
|
||
- name: Export digest | ||
run: docker save pyramid:tests -o "./pyramid-tests.tar" | ||
|
||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-tests | ||
path: ./pyramid-tests.tar | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
tests_in_docker: | ||
name: "Tests" | ||
needs: ["docker_image_test_build"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download test digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: digests-tests | ||
|
||
- name: Load Docker image | ||
run: docker load -i "./pyramid-tests.tar" | ||
|
||
- name: Run unit tests | ||
run: | | ||
mkdir -p ./coverage && chmod 777 ./coverage | ||
docker run --rm -v ./coverage:/app/coverage -e SPOTIFY__CLIENT_ID=${{ secrets.CONFIG_SPOTIFY_CLIENT_ID }} -e SPOTIFY__CLIENT_SECRET=${{ secrets.CONFIG_SPOTIFY_CLIENT_SECRET }} pyramid:tests | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: tristiisch/PyRamid | ||
files: ./cover/result |