This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
Updates to documentation and scripts #57
Workflow file for this run
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
name: E2E Build | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'README.md' | ||
env: | ||
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | ||
EnvironmentName: e2e-${{ github.event.pull_request.user.login }} | ||
jobs: | ||
build_proxy: | ||
runs-on: ubuntu-latest | ||
name: .NET restore, build & test | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore ./src/EasyAuthForK8s.Web/EasyAuthForK8s.Web.csproj | ||
- name: Build | ||
run: dotnet build ./src/EasyAuthForK8s.Web/EasyAuthForK8s.Web.csproj --no-restore | ||
- name: Test | ||
run: dotnet test ./src/Tests/EasyAuthForK8s.Tests.Web/EasyAuthForK8s.Tests.Web.csproj --no-build --verbosity normal | ||
check_changes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: | | ||
sample: | ||
- 'sample/EasyAuthForK8s.Sample/**' | ||
build_and_push_sample_app: | ||
Check failure on line 41 in .github/workflows/E2E.yml
|
||
needs: check_changes | ||
if: needs.check_changes.outputs.sample == 'false' | ||
uses: ./.github/workflows/Build-Sample-App.yml | ||
with: | ||
EnvironmentName: e2e-${{ github.event.pull_request.user.login }} | ||
secrets: inherit | ||
check_for_deprecated_APIs: | ||
name: Check Deprecated K8s APIs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
- name: Download Pluto | ||
uses: FairwindsOps/pluto/github-action@master | ||
- name: Use pluto | ||
run: | | ||
pluto detect-files -d ./charts/easyauth-proxy | ||
pluto detect-files -d ./ | ||
run_e2e_test: | ||
if: | | ||
always() && | ||
(needs.build_and_push_sample_app.result == 'skipped' || needs.build_and_push_sample_app.result == 'success') && | ||
needs.build_proxy.result == 'success' && | ||
needs.check_for_deprecated_APIs.result == 'success' | ||
needs: [check_for_deprecated_APIs, build_and_push_sample_app, build_proxy] | ||
runs-on: ubuntu-latest | ||
environment: e2e-${{ github.event.pull_request.user.login }} | ||
name: Run end-to-end test | ||
steps: | ||
- name: 'Login via Azure CLI' | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
${{ vars.docker_repo }}/easy-auth-proxy | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Call the script | ||
continue-on-error: true | ||
run: | | ||
bash main.sh -a "${{ vars.e2ePrefix }}-${{ env.GITHUB_PR_NUMBER }}" -c "${{ vars.e2ePrefix }}-${{ env.GITHUB_PR_NUMBER }}" -r "${{ vars.e2ePrefix }}-${{ env.GITHUB_PR_NUMBER }}" -e ${{ vars.email }} -l ${{ vars.location }} -v "pr-${{ env.GITHUB_PR_NUMBER }}" -d "docker.io/${{ vars.docker_repo }}" | ||
- name: Delete e2e environment | ||
if: ${{ vars.DeleteOnFailure == 'true' }} || success() | ||
run: | | ||
if [ $(az group exists --name ${{ vars.e2ePrefix }}-${{ env.GITHUB_PR_NUMBER }}) == "true" ]; then | ||
az group delete -n ${{ vars.e2ePrefix }}-${{ env.GITHUB_PR_NUMBER }} --yes | ||
fi | ||
app_id=$(az ad app list --display-name ${{ vars.e2ePrefix}}-${{ env.GITHUB_PR_NUMBER }} --query "[0].appId" -o tsv) | ||
if [ "$app_id" != "" ]; then | ||
az ad app delete --id $app_id | ||
fi | ||