Skip to content

Commit

Permalink
Create CI job to run melee-issues (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribbanya authored Oct 9, 2023
1 parent 8b1d49f commit e09fd53
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/packages/check-issues/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM rust:latest AS check-issues
COPY .github/packages/check-issues/setup.sh /usr/local/bin
COPY . /input
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C
RUN chmod +x /usr/local/bin/setup.sh && setup.sh
RUN rm -rf /input
VOLUME [ "/input" ]
COPY .github/packages/check-issues/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh
6 changes: 6 additions & 0 deletions .github/packages/check-issues/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

cd /input

melee-issues
13 changes: 13 additions & 0 deletions .github/packages/check-issues/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e

apt update

apt install -y --no-install-recommends \
libclang-dev

cargo install --path /input/tools/issues

apt autoremove -y
apt clean
rm -rf /var/lib/apt/lists/*
52 changes: 51 additions & 1 deletion .github/workflows/build-melee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ jobs:

- name: Set step summary
if: matrix.make_flags == 'GENERATE_MAP=1'
run: cat /tmp/output/PROGRESS.md >> $GITHUB_STEP_SUMMARY
run: |
printf "\`\`\`\n%s\n\`\`\`" "$(cat /tmp/output/PROGRESS.md)" \
>> $GITHUB_STEP_SUMMARY
build-windows:
name: Windows
Expand Down Expand Up @@ -136,3 +138,51 @@ jobs:
--volume "${output}:C:/Output" `
--env MAKE_FLAGS="$env:MAKE_FLAGS" `
"$env:REGISTRY/$env:IMAGE"
check-issues:
name: Issues
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io

steps:
- name: Get image name
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REPO_NAME: ${{ github.repository }}
PR_REPO_NAME: ${{ github.event.repository.full_name }}
IMAGE_SUFFIX: check-issues:latest
run: |
result=""
case "$EVENT_NAME" in
push)
result="$PUSH_REPO_NAME"
;;
pull_request)
result="$PR_REPO_NAME"
;;
esac
result=$(echo "$result/$IMAGE_SUFFIX" | tr '[:upper:]' '[:lower:]')
echo "IMAGE=$result" >> $GITHUB_ENV
- name: Checkout Melee repository
uses: actions/checkout@v3

- name: Log into container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull build image
run: docker pull "$REGISTRY/$IMAGE"

- name: Check for code issues
run: |
result=$(docker run --rm \
--volume "$PWD:/input:ro" \
"$REGISTRY/$IMAGE")
echo "$result"
printf "\`\`\`\n%s\n\`\`\`" "$result" >> $GITHUB_STEP_SUMMARY
9 changes: 8 additions & 1 deletion .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
CONTAINERFILE: .github/packages/${{ matrix.target }}/Dockerfile
strategy:
matrix:
target: [ "build-linux", "gen-pages" ]
target: [ "build-linux", "gen-pages", "check-issues" ]
fail-fast: false
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -79,6 +79,13 @@ jobs:
--env MAKE_FLAGS="NON_MATCHING=1" \
"$IMAGE:test"
- name: Try checking for code issues
if: matrix.target == 'check-issues'
run: |
docker run --rm \
--volume "$PWD:/input:ro" \
"$IMAGE:test"
- name: Try generating pages
if: matrix.target == 'gen-pages'
run: |
Expand Down

0 comments on commit e09fd53

Please sign in to comment.