Skip to content

Commit

Permalink
Merge branch 'develop' into chore/exam-import-client-migration
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/webapp/app/exam/manage/exam-management.module.ts
#	src/test/javascript/spec/component/exam/manage/exam-import.component.spec.ts
  • Loading branch information
coolchock committed Feb 13, 2025
2 parents 2da145c + bbe907c commit 4a0fa55
Show file tree
Hide file tree
Showing 1,017 changed files with 15,602 additions and 12,487 deletions.
13 changes: 1 addition & 12 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,7 @@ Prerequisites:
4. ...

### Testserver States
> [!NOTE]
> These badges show the state of the test servers.
> Green = Currently available, Red = Currently locked
> Click on the badges to get to the test servers.
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test1)](https://artemis-test1.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test2)](https://artemis-test2.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test3)](https://artemis-test3.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test4)](https://artemis-test4.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test5)](https://artemis-test5.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test6)](https://artemis-test6.artemis.cit.tum.de)
[![](https://byob.yarr.is/ls1intum/Artemis/artemis-test9)](https://artemis-test9.artemis.cit.tum.de)
You can manage test servers using [Helios](https://helios.aet.cit.tum.de/). Check environment statuses in the [environment list](https://helios.aet.cit.tum.de/repo/69562331/environment/list). To deploy to a test server, go to the [CI/CD](https://helios.aet.cit.tum.de/repo/69562331/ci-cd) page, find your PR or branch, and trigger the deployment.

### Review Progress
<!-- Each PR should be reviewed by at least two other developers. The code, the functionality (= manual test) and the exam mode need to be reviewed. -->
Expand Down
192 changes: 87 additions & 105 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,118 +31,100 @@ on:
types:
- created

# Keep in sync with codeql-analysis.yml and test.yml and analysis-of-endpoint-connections.yml
env:
CI: true
node: 22
java: 21
RAW_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}
# Keep this filename in sync with the filename environment variable (PR_AUTO_BUILD_FILE_NAME) in the testserver-deployment.yml workflow

jobs:

build:
name: Build .war artifact
define-inputs:
name: Define Inputs
runs-on: ubuntu-latest
outputs:
release_upload: ${{ steps.set-upload-release.outputs.release_upload }}
release_url: ${{ steps.set-upload-release.outputs.release_url }}
release_path: ${{ steps.set-upload-release.outputs.release_path }}
release_name: ${{ steps.set-upload-release.outputs.release_name }}
release_type: ${{ steps.set-upload-release.outputs.release_type }}
docker_build: ${{ steps.set-docker-build.outputs.docker_build }}
docker_ref: ${{ steps.set-docker-ref.outputs.docker_ref }}
docker_build_tag: ${{ steps.set-docker-tag.outputs.docker_build_tag }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ env.node }}'
cache: 'npm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '${{ env.java }}'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Production Build
run: ./gradlew -Pprod -Pwar clean bootWar
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Artemis.war
path: build/libs/Artemis-*.war
- name: Upload Release Artifact
if: github.event_name == 'release' && github.event.action == 'created'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/libs/Artemis-${{ github.event.release.tag_name }}.war
asset_name: Artemis.war
asset_content_type: application/x-webarchive
- name: Set Upload Release Artifact Outputs
id: set-upload-release
run: |
# If event is release created, set the release_upload flag and the release artifact details
if [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "created" ]]; then
echo "release_upload=true" >> $GITHUB_OUTPUT
echo "release_url=${{ github.event.release.upload_url }}" >> $GITHUB_OUTPUT
echo "release_path=build/libs/Artemis-${{ github.event.release.tag_name }}.war" >> $GITHUB_OUTPUT
echo "release_name=Artemis.war" >> $GITHUB_OUTPUT
echo "release_type=application/x-webarchive" >> $GITHUB_OUTPUT
else
echo "release_upload=false" >> $GITHUB_OUTPUT
fi
docker:
name: Build and Push Docker Image
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'ls1intum/Artemis' }}
runs-on: ubuntu-latest
steps:
- name: Compute Tag
uses: actions/github-script@v7
id: compute-tag
with:
result-encoding: string
script: |
if (context.eventName === "pull_request") {
return "pr-" + context.issue.number;
}
if (context.eventName === "release") {
return "latest";
}
if (context.eventName === "push") {
if (context.ref.startsWith("refs/tags/")) {
return context.ref.slice(10);
- name: Set Docker Build Flag
id: set-docker-build
run: |
if [[ ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'ls1intum/Artemis' }} ]]; then
echo "docker_build=true" >> $GITHUB_OUTPUT
else
echo "docker_build=false" >> $GITHUB_OUTPUT
fi
- name: Set Docker ref
if: ${{ steps.set-docker-build.outputs.docker_build == 'true' }}
id: set-docker-ref
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# Checkout pull request HEAD commit instead of merge commit
# this is done to include the correct branch and git information inside the build
echo "docker_ref=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "docker_ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Compute Docker Tag
if: ${{ steps.set-docker-build.outputs.docker_build == 'true' }}
uses: actions/github-script@v7
id: compute-tag
with:
result-encoding: string
script: |
if (context.eventName === "pull_request") {
return "pr-" + context.issue.number;
}
if (context.eventName === "release") {
return "latest";
}
if (context.ref === "refs/heads/develop") {
return "develop";
if (context.eventName === "push") {
if (context.ref.startsWith("refs/tags/")) {
return context.ref.slice(10);
}
if (context.ref === "refs/heads/develop") {
return "develop";
}
}
}
return "FALSE";
- name: Git Checkout for PRs
if: ${{ github.event_name == 'pull_request' }}
# Checkout pull request HEAD commit instead of merge commit
# this is done to include the correct branch and git information inside the build
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Git Checkout for push actions
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Git Checkout for push actions
if: ${{ github.event_name == 'release' }}
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build and Push to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push to GitHub Container Registry
uses: docker/build-push-action@v5
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
with:
# beware that the linux/arm64 build from the registry is using an amd64 compiled .war file as
# the GitHub runners don't support arm64 and QEMU takes too long for emulating the build
platforms: linux/amd64,linux/arm64
file: ./docker/artemis/Dockerfile
context: .
tags: ghcr.io/ls1intum/artemis:${{ steps.compute-tag.outputs.result }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=min
return "FALSE";
- name: Set Docker Tag
id: set-docker-tag
run: |
if [[ ${{ steps.compute-tag.outputs.result != 'FALSE' }} ]]; then
echo "docker_build_tag=${{ steps.compute-tag.outputs.result }}" >> $GITHUB_OUTPUT
fi
# TODO: Push to Docker Hub (develop + tag)
# TODO: Push to Chair Harbour (??)
call-build-workflow:
name: Call Build Workflow
needs: define-inputs
uses: ./.github/workflows/reusable-build.yml
with:
build_war: true
release_upload: ${{ needs.define-inputs.outputs.release_upload == 'true' }}
release_url: ${{ needs.define-inputs.outputs.release_url }}
release_path: ${{ needs.define-inputs.outputs.release_path }}
release_name: ${{ needs.define-inputs.outputs.release_name }}
release_type: ${{ needs.define-inputs.outputs.release_type }}
docker: ${{ needs.define-inputs.outputs.docker_build == 'true' }}
docker_ref: ${{ needs.define-inputs.outputs.docker_ref }}
docker_build_tag: ${{ needs.define-inputs.outputs.docker_build_tag }}
76 changes: 0 additions & 76 deletions .github/workflows/pullrequest-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,79 +18,3 @@ jobs:
token: ${{ secrets.GH_TOKEN_ADD_TO_PROJECT }}
tag: pr-${{ github.event.pull_request.number }}
untagged-older-than: 28

# If a PR is closed the testserver lock should be removed and corresponding badges updated
process_labels:
name: Process labels
runs-on: ubuntu-latest
outputs:
labels: ${{ steps.process.outputs.labels }}
badges: ${{ steps.process.outputs.badges }}
steps:
- name: Process labels
id: process
uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const labelsToRemove = [];
const labelsToProcess = [];
// Get the PR number
const prNumber = context.payload.pull_request.number;
// Iterate through labels on the PR
for (const label of context.payload.pull_request.labels) {
const labelName = label.name;
const regex = /^lock:artemis-test(\d+)$/;
if (regex.test(labelName)) {
// Extract the part after "lock:" using capture groups
const extractedLabel = labelName.match(regex)[1];
labelsToProcess.push(extractedLabel);
labelsToRemove.push(labelName);
}
}
// Do something with the extracted labels
console.log('Badges to process:', labelsToProcess);
console.log('Labels to remove:', labelsToRemove);
// Use the labelsToRemove array to remove the matching labels
core.setOutput('badges', JSON.stringify(labelsToProcess));
core.setOutput('labels', labelsToRemove.join(', '));
remove_labels:
name: Remove labels
needs: process_labels
runs-on: ubuntu-latest
if: ${{ needs.process_labels.outputs.labels != '' }}

steps:
- name: Remove labels
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: ${{ needs.process_labels.outputs.labels }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update_badges:
name: Update badges
needs: process_labels
runs-on: ubuntu-latest
strategy:
matrix:
badge: ${{ fromJson(needs.process_labels.outputs.badges) }}
if: ${{ needs.process_labels.outputs.labels != '' }}

steps:
- name: Update badge
uses: RubbaBoy/[email protected]
with:
NAME: "artemis-test${{ matrix.badge }}"
LABEL: "artemis-test${{ matrix.badge }}.artemis.cit.tum.de"
STATUS: ${{ github.event.pull_request.head.ref }}
COLOR: green
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 0 additions & 33 deletions .github/workflows/pullrequest-unlabeled.yml

This file was deleted.

Loading

0 comments on commit 4a0fa55

Please sign in to comment.