diff --git a/.gitea/workflows/default.yaml b/.gitea/workflows/default.yaml index 71c51138..354d9a18 100644 --- a/.gitea/workflows/default.yaml +++ b/.gitea/workflows/default.yaml @@ -1,82 +1,21 @@ -name: Test1Deploy +name: Testing Example on: - workflow_call: - workflow_dispatch: + push: + branches: + - master -jobs: +jobs: + +# Builds the image and pushes it to the registry +# This image contains all the tooling necessary to run the compilation tools build-image: - stage: build-image - # Run image build only if packages changed - only: - changes: - - Dockerfile - - packages.txt - - requirements.txt - - .gitlab-ci.yml - - tools/* # Set up the docker daemon for building the image - image: docker:latest - services: - - docker:dind - variables: - DOCKER_DRIVER: overlay2 - script: - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY # Login to the registry - - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME || true # Pull the image if it exists - # Build the image and tag it with the branch name and latest - - | - docker build \ - --build-arg BUILDKIT_INLINE_CACHE=1 \ - --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME \ - -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME \ - -t $CI_REGISTRY_IMAGE:latest \ - . - - docker push --all-tags $CI_REGISTRY_IMAGE # Push the image to the registry - - # Try to compile the code inside the image to make sure it works (run docker container) - build-test-us10: - stage: test - image: - name: $CI_REGISTRY_IMAGE:latest - entrypoint: [""] - before_script: - # Download the baserom from $BASEROM__URL, decrypt with $BASEROM__KEY and save as baserom.us.v10.z64, and check the sha1sum against $BASEROM__SHA1 - - curl -L "$BASEROM_US10_URL" -o baserom.us.v10.enc.z64 - - openssl enc -d -aes-256-cbc -in baserom.us.v10.enc.z64 -out baserom.us.v10.z64 -k "$BASEROM_US10_KEY" - - FILE_SHA1=$(sha1sum baserom.us.v10.z64 | awk '{ print $1 }') - - echo "Calculated SHA1 - $FILE_SHA1" - - echo "Expected SHA1 - $BASEROM_US10_SHA1" - - if [ "${FILE_SHA1}" != "${BASEROM_US10_SHA1}" ]; then echo "Checksum verification failed"; exit 1; else echo "Checksum verification passed"; fi - script: - # Compile the code - - make - # Check if the resulting ROM is the same as the expected one - - FILE_SHA1=$(sha1sum build/us.v10/banjo.us.v10.z64 | awk '{ print $1 }') - - echo "Calculated SHA1 - $FILE_SHA1" - - echo "Expected SHA1 - $BASEROM_US10_SHA1" - - if [ "${FILE_SHA1}" != "${BASEROM_US10_SHA1}" ]; then echo "Checksum verification failed"; exit 1; else echo "Checksum verification passed"; fi - - # Try to compile the code inside the image to make sure it works (run docker container) - build-test-pal: - stage: test - image: - name: $CI_REGISTRY_IMAGE:latest - entrypoint: [""] - before_script: - - curl -L "$BASEROM_PAL_URL" -o baserom.pal.enc.z64 - - openssl enc -d -aes-256-cbc -in baserom.pal.enc.z64 -out baserom.pal.z64 -k "$BASEROM_PAL_KEY" - - FILE_SHA1=$(sha1sum baserom.pal.z64 | awk '{ print $1 }') - - echo "Calculated SHA1 - $FILE_SHA1" - - echo "Expected SHA1 - $BASEROM_PAL_SHA1" - - if [ "${FILE_SHA1}" != "${BASEROM_PAL_SHA1}" ]; then echo "Checksum verification failed"; exit 1; else echo "Checksum verification passed"; fi - script: - # Compile the code - - make VERSION=pal - # Check if the resulting decompressed ROM is the same as the expected one - # ToDo: compare compressed ROMs once tooling is in place - - DECOMP_SHA1=$(sha1sum decompressed.pal.z64 | awk '{ print $1 }') - - FILE_SHA1=$(sha1sum build/pal/banjo.pal.prelim.z64 | awk '{ print $1 }') - - echo "Calculated SHA1 - $FILE_SHA1" - - echo "Expected SHA1 - $DECOMP_SHA1" - - if [ "${FILE_SHA1}" != "${DECOMP_SHA1}" ]; then echo "Checksum verification failed"; exit 1; else echo "Checksum verification passed"; fi + runs-on: docker:latest + steps: + - name: build-image + - run: docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY # Login to the registry + - run: docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME || true # Pull the image if it exists + # Build the image and tag it with the branch name and latest + - run: docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -t $CI_REGISTRY_IMAGE:latest . + - run: docker push --all-tags $CI_REGISTRY_IMAGE # Push the image to the registry \ No newline at end of file