diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index a4e73f2d..b70e2af8 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -9,7 +9,7 @@ on: jobs: build: runs-on: ubuntu-latest - container: pspdev/psptoolchain:latest + container: ghcr.io/fjtrujy/psptoolchain:latest steps: - uses: actions/checkout@v2 @@ -22,5 +22,24 @@ jobs: ./bootstrap ./configure make clean - make -j2 + make -j $(getconf _NPROCESSORS_ONLN) make install + + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + + - name: Compile Examples + run: | + cd src/samples && make -f Makefile.samples + + - name: Compress Samples folder folder + run: | + tar -zcvf samples.tar.gz src/samples + + - name: Upload Samples artifacts + if: ${{ success() }} + uses: actions/upload-artifact@v2 + with: + name: samples-${{ steps.slug.outputs.sha8 }} + path: samples.tar.gz diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 470c9eb4..b4a0fc4a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,21 +4,66 @@ on: push: branches: - master + tags: + - v* repository_dispatch: types: [run_build] + jobs: build: runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v2 - - uses: docker/build-push-action@v1 + - name: Extract DOCKER_TAG using tag name + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + + - name: Use default DOCKER_TAG + if: startsWith(github.ref, 'refs/tags/') != true + run: | + echo "DOCKER_TAG=latest" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Github registry + uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: ${{ env.GITHUB_REPOSITORY }} - tags: latest - tag_with_ref: true - add_git_labels: true + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + + - uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} + build-args: | + BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/psptoolchain:${{ env.DOCKER_TAG }} + + - name: Send Compile action + run: | + export DISPATCH_ACTION="$(echo run_build)" + echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV + + - name: Repository Dispatch to psp-packages + uses: peter-evans/repository-dispatch@v1 + with: + repository: ${{ github.repository_owner }}/psp-packages + token: ${{ secrets.DISPATCH_TOKEN }} + event-type: ${{ env.NEW_DISPATCH_ACTION }} + client-payload: '{"ref": "${{ github.ref }}"}' + + - name: Repository Dispatch to psplinkusb + uses: peter-evans/repository-dispatch@v1 + with: + repository: ${{ github.repository_owner }}/psplinkusb + token: ${{ secrets.DISPATCH_TOKEN }} + event-type: ${{ env.NEW_DISPATCH_ACTION }} + client-payload: '{"ref": "${{ github.ref }}"}' \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fedcd0b8..370a72e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,26 @@ # First stage -FROM pspdev/psptoolchain:latest +ARG BASE_DOCKER_IMAGE + +FROM $BASE_DOCKER_IMAGE COPY . /src RUN apk add build-base autoconf automake zlib-dev -RUN cd /src && ./bootstrap && ./configure && make all install clean +RUN cd /src && \ + ./bootstrap && \ + ./configure && \ + make -j $(getconf _NPROCESSORS_ONLN) clean && \ + make -j $(getconf _NPROCESSORS_ONLN) && \ + make -j $(getconf _NPROCESSORS_ONLN) install + +## gcc needs to include libpsplibc libpsputility libpspnet_inet libpspnet_resolver libpspuser libpspkernel +## from pspsdk to be able to build executables, because they are part of the standard libraries +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpsplibc.a" "$PSPDEV/psp/lib/libpsplibc.a" || { exit 1; } +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpsputility.a" "$PSPDEV/psp/lib/libpsputility.a" || { exit 1; } +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpspnet_inet.a" "$PSPDEV/psp/lib/libpspnet_inet.a" || { exit 1; } +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpspnet_resolver.a" "$PSPDEV/psp/lib/libpspnet_resolver.a" || { exit 1; } +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpspuser.a" "$PSPDEV/psp/lib/libpspuser.a" || { exit 1; } +RUN ln -sf "$PSPDEV/psp/sdk/lib/libpspkernel.a" "$PSPDEV/psp/lib/libpspkernel.a" || { exit 1; } # Second stage FROM alpine:latest