diff --git a/.github/workflows/publish-docker-tester.yml b/.github/workflows/publish-docker-tester.yml index f6f7315a7..78148a863 100644 --- a/.github/workflows/publish-docker-tester.yml +++ b/.github/workflows/publish-docker-tester.yml @@ -68,7 +68,6 @@ jobs: version: latest endpoint: ${{ env.CONTEXT_NAME }} # self-hosted - name: Login to GHCR - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io @@ -80,25 +79,11 @@ jobs: with: context: . platforms: ${{env.platforms}} - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} target: tester secrets: | - "github_token=${{ secrets.BOT_PAT }}" - test: - runs-on: [ self-hosted, dpdk ] - needs: buildAndPushTester - steps: - - name: Determine SHA for Docker Image - id: get_sha - run: | - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - echo "DOCKER_IMAGE_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV - else - echo "DOCKER_IMAGE_SHA=${{ github.sha }}" >> $GITHUB_ENV - fi - - name: Run tests - id: run_tests - run: | - docker run --privileged --mount type=bind,source=/dev/hugepages,target=/dev/hugepages ghcr.io/ironcore-dev/dpservice-tester:${{ env.DOCKER_IMAGE_SHA }} + "github_token=${{ secrets.GITHUB_TOKEN }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 8325bd865..3028e904e 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -74,5 +74,3 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} target: production - secrets: | - "github_token=${{ secrets.BOT_PAT }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..584526744 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,19 @@ +name: Pull Request Code test + +on: + pull_request: + types: [ assigned, opened, synchronize, reopened ] + paths-ignore: + - 'docs/**' + - '**/*.md' + +jobs: + checks: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + - run: make test diff --git a/Dockerfile b/Dockerfile index 8a6e0d139..8641f6f95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,7 +89,6 @@ COPY .git/ .git/ # therefore downloading using 'ADD' is not possible RUN --mount=type=secret,id=github_token,dst=/run/secrets/github_token \ sh -c 'GITHUB_TOKEN=$(if [ -f /run/secrets/github_token ]; then cat /run/secrets/github_token; else echo ""; fi) \ -&& ./hack/rel_download.sh -dir=exporter -owner=ironcore-dev -repo=prometheus-dpdk-exporter -pat=$GITHUB_TOKEN \ && ./hack/rel_download.sh -dir=client -owner=ironcore-dev -repo=dpservice-cli -strip=2 -pat=$GITHUB_TOKEN' # Compile dpservice-bin itself