[ci] Switch to make targets in all workflows

This commit is contained in:
Laura Hausmann 2024-07-07 03:40:02 +02:00
parent 527537db28
commit 553cafb4f9
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 21 additions and 73 deletions

View file

@ -12,25 +12,14 @@ jobs:
--volume /root/.docker:/root/.docker
steps:
- name: Clone repository
run: |
git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 /iceshrimp
cd /iceshrimp
run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 .
- name: Run unit tests
run: |
cd /iceshrimp
dotnet test
- name: Clean repo
run: |
cd /iceshrimp
git clean -xfd
- name: Authenticate against the docker registry
run: docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
- name: Initialize builder
run: docker buildx use iceshrimp-ci || docker buildx create --name iceshrimp-ci --use
- name: Patch Dockerfile
run: sed -i 's^mcr.microsoft.com/dotnet/sdk:8.0-alpine^iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine^g' /iceshrimp/Dockerfile
- name: Build the image
run: make test
- name: Build docker image
shell: bash
run: docker buildx build -t iceshrimp.dev/${GITHUB_REPOSITORY@L}:$GITHUB_REF_NAME --provenance=false --platform=linux/amd64,linux/arm64 --push /iceshrimp
- name: Purge cache
run: docker buildx prune --keep-storage 20G
run: |
git clean -xfdq
docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
docker buildx create --name iceshrimp-ci 2>&1 &>/dev/null || true
docker buildx build -t iceshrimp.dev/${GITHUB_REPOSITORY@L}:$GITHUB_REF_NAME --provenance=false --platform=linux/amd64,linux/arm64 --push --builder iceshrimp-ci .
docker buildx prune --keep-storage 20G

View file

@ -10,49 +10,14 @@ jobs:
options: --volume /opt/iceshrimp-cache/nuget:/root/.nuget
steps:
- name: Clone repository
run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 /src
- name: Build project (amd64-glibc)
shell: bash
run: |-
cd /src/Iceshrimp.Backend
mkdir -p /out/linux-amd64
dotnet publish -c Release -p:EnableAOT=true -p:EnableLibVips=true -p:BundleNativeDeps=true -r linux-amd64 -o /out/linux-amd64
- name: Build project (arm64-glibc)
shell: bash
run: |-
cd /src/Iceshrimp.Backend
mkdir -p /out/linux-arm64
dotnet publish -c Release -p:EnableAOT=true -p:EnableLibVips=true -p:BundleNativeDeps=true -r linux-arm64 -o /out/linux-arm64
- name: Build project (amd64-musl)
shell: bash
run: |-
cd /src/Iceshrimp.Backend
mkdir -p /out/linux-musl-amd64
dotnet publish -c Release -p:EnableAOT=true -p:EnableLibVips=true -p:BundleNativeDeps=true -r linux-musl-amd64 -o /out/linux-musl-amd64
- name: Build project (arm64-musl)
shell: bash
run: |-
cd /src/Iceshrimp.Backend
mkdir -p /out/linux-musl-arm64
dotnet publish -c Release -p:EnableAOT=true -p:EnableLibVips=true -p:BundleNativeDeps=true -r linux-musl-arm64 -o /out/linux-musl-arm64
- name: Generate artifacts
shell: bash
run: |-
mkdir artifacts
tar cavf artifacts/${{ github.event.repository.name }}-${{ github.ref_name }}-linux-amd64-glibc.tar.zst --transform 's,^out/linux-amd64,${{ github.event.repository.name }}-${{ github.ref_name }},' /out/linux-amd64
tar cavf artifacts/${{ github.event.repository.name }}-${{ github.ref_name }}-linux-arm64-glibc.tar.zst --transform 's,^out/linux-arm64,${{ github.event.repository.name }}-${{ github.ref_name }},' /out/linux-arm64
tar cavf artifacts/${{ github.event.repository.name }}-${{ github.ref_name }}-linux-amd64-musl.tar.zst --transform 's,^out/linux-musl-amd64,${{ github.event.repository.name }}-${{ github.ref_name }},' /out/linux-musl-amd64
tar cavf artifacts/${{ github.event.repository.name }}-${{ github.ref_name }}-linux-arm64-musl.tar.zst --transform 's,^out/linux-musl-arm64,${{ github.event.repository.name }}-${{ github.ref_name }},' /out/linux-musl-arm64
run: git clone ${{ github.event.repository.clone_url }} --branch=${{ github.ref_name }} --depth=1 .
- name: Build release artifacts
run: make ARCHIVE_BASENAME=${{ github.event.repository.name }} ARCHIVE_VERSION=${{ github.ref_name }} release-artifacts
- name: Upload artifacts
uses: actions/release-action@main
with:
files: |-
artifacts/**
files: artifacts/**
api_key: '${{secrets.RELEASE_TOKEN}}'
- name: Authenticate against the docker registry
run: docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
- name: Initialize builder
run: docker buildx use iceshrimp-ci || docker buildx create --name iceshrimp-ci --use
- name: Set environment variables
shell: bash
run: |
@ -73,10 +38,9 @@ jobs:
# Finally, we pass the computed tags back to the actions environment
echo "TAGS=$TAGS" >> "${GITHUB_ENV}"
- name: Build the image
shell: bash
- name: Build docker image
run: |
cp /src/.docker/dotnet-runner-8.0.Dockerfile /out/Dockerfile
docker buildx build ${{ env.TAGS }} --provenance=false --platform=linux/amd64,linux/arm64 --push /out
- name: Purge cache
run: docker buildx prune --keep-storage 20G
docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
docker buildx create --name iceshrimp-ci 2>&1 &>/dev/null || true
docker buildx build ${{ env.TAGS }} --provenance=false --platform=linux/amd64,linux/arm64 --push --builder iceshrimp-ci -f ./.docker/dotnet-runner-8.0.Dockerfile ./release
docker buildx prune --keep-storage 20G

View file

@ -7,19 +7,14 @@ jobs:
test-build:
runs-on: docker
container:
image: iceshrimp.dev/iceshrimp/dotnet-sdk:8.0-alpine
image: iceshrimp.dev/iceshrimp/ci-env:dotnet
options: --volume /opt/iceshrimp-cache/nuget:/root/.nuget
steps:
- name: Clone repository
shell: bash
run: |
mkdir /iceshrimp
cd /iceshrimp
git init -b test-build
git remote add origin ${{ github.event.repository.clone_url }}
git fetch origin ${{ github.ref }} --depth=1
git checkout --detach FETCH_HEAD
- name: Run tests
run: |
cd /iceshrimp
dotnet test
- name: Run unit tests
run: make test