Skip to content

Commit

Permalink
Merge pull request #48 from ben-wes/build-tests
Browse files Browse the repository at this point in the history
workflow: change dependencies for merging, clean-up
  • Loading branch information
agraef committed Aug 25, 2024
2 parents 3fc5af7 + 8ebd3e8 commit 00280e9
Showing 1 changed file with 70 additions and 77 deletions.
147 changes: 70 additions & 77 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

jobs:
ubuntu-build:

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -34,7 +33,6 @@ jobs:
path: build

macos-build:

runs-on: macos-latest
strategy:
matrix:
Expand All @@ -61,7 +59,6 @@ jobs:
path: build

windows-build:

runs-on: windows-2019
strategy:
matrix:
Expand Down Expand Up @@ -99,107 +96,103 @@ jobs:

# Big thanks to @tomara-x and @timothyschoen for showing me how to do this! -ag

release:
github-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [ubuntu-build, macos-build, windows-build]

steps:
- uses: actions/download-artifact@v4

- name: ziptie
run: |
mkdir dist
for x in pdlua-*; do (cd $x && zip -r ../dist/$x.zip pdlua/); done
- name: release
uses: softprops/action-gh-release@v2
with:
prerelease: true
draft: true
files: dist/*.zip

merge:
merge-for-deken:
runs-on: ubuntu-latest
needs: [ubuntu-build, macos-build, windows-build]
needs: [github-release]
permissions:
contents: write
actions: read
strategy:
matrix:
os: [windows, macos, ubuntu]

steps:
- name: Download Artifacts # FIXME: currently downloads all artifacts redundantly for each OS
uses: actions/download-artifact@v4
with:
path: artifacts
- name: download artifacts # FIXME: currently downloads all artifacts redundantly for each OS
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Merge Artifacts to Package
run: cp -rn artifacts/pdlua-${{ matrix.os }}*/* .
- name: merge artifacts to package
run: cp -rn artifacts/pdlua-${{ matrix.os }}*/* .

- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: pdlua-${{ matrix.os }}
path: pdlua
- name: upload package
uses: actions/upload-artifact@v4
with:
name: pdlua-${{ matrix.os }}
path: pdlua

deken_check_and_upload:
deken-check:
runs-on: ubuntu-latest
needs: [merge]
if: startsWith(github.ref, 'refs/tags/')
needs: [merge-for-deken]
strategy:
matrix:
os: [windows, macos, ubuntu]

steps:
- uses: actions/download-artifact@v4
with:
name: pdlua-${{ matrix.os }}
path: pdlua-${{ matrix.os }}

- name: check deken package
shell: bash
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
echo "## ${{ matrix.os }}" | tee -a $GITHUB_STEP_SUMMARY
mkdir -p package-${{ matrix.os }}
docker run --rm --user $(id -u) --volume ./pdlua-${{ matrix.os }}:/pdlua \
--volume ./package-${{ matrix.os }}:/package registry.git.iem.at/pd/deken \
deken package --output-dir /package -v "${VERSION}" /pdlua
dek_files=$(ls package-${{ matrix.os }}/*.dek)
for dek_file in $dek_files; do
filename=$(basename "$dek_file")
echo -e "#### \`$filename\`" | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
unzip -l "$dek_file" | awk 'NR>3 {print $4}' | sed '/^$/d' | sort | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
done
deken-upload:
if: ${{ !contains(github.ref, 'test') }} # upload if not a "test" tag (maybe should be more restrictive?)
runs-on: ubuntu-latest
needs: [merge-for-deken]

steps:
- uses: actions/checkout@v4
with:
path: pdlua-src

- uses: actions/download-artifact@v4
with:
name: pdlua-windows
path: pdlua-windows

- uses: actions/download-artifact@v4
with:
name: pdlua-macos
path: pdlua-macos

- uses: actions/download-artifact@v4
with:
name: pdlua-ubuntu
path: pdlua-ubuntu

- name: Check Deken Package
shell: bash
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
for os in ubuntu macos windows; do
echo "## ${os}" | tee -a $GITHUB_STEP_SUMMARY
mkdir -p package-${os}
docker run --rm --user $(id -u) --volume ./pdlua-${os}:/pdlua \
--volume ./package-${os}:/package registry.git.iem.at/pd/deken \
deken package --output-dir /package -v "${VERSION}" /pdlua
dek_files=$(ls package-${os}/*.dek)
for dek_file in $dek_files; do
filename=$(basename "$dek_file")
echo -e "#### \`$filename\`" | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
unzip -l "$dek_file" | awk 'NR>3 {print $4}' | sed '/^$/d' | sort | tee -a $GITHUB_STEP_SUMMARY
echo '```' | tee -a $GITHUB_STEP_SUMMARY
done
done
- name: Upload Deken Package
if: ${{ !contains(github.ref, 'test') }} # upload if not a "test" release
shell: bash
env:
DEKEN_USERNAME: ${{ secrets.DEKEN_USERNAME }}
DEKEN_PASSWORD: ${{ secrets.DEKEN_PASSWORD }}
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
for os in ubuntu macos windows; do
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./pdlua-${os}:/pdlua registry.git.iem.at/pd/deken \
deken upload --no-source-error -v "${VERSION}" /pdlua
done
- name: upload deken package
shell: bash
env:
DEKEN_USERNAME: ${{ secrets.DEKEN_USERNAME }}
DEKEN_PASSWORD: ${{ secrets.DEKEN_PASSWORD }}
run: |
SHORT=${GITHUB_REF:10}
VERSION=${SHORT//\//_}
for os in ubuntu macos windows; do
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./pdlua-src:/pdlua registry.git.iem.at/pd/deken \
deken upload -v "${VERSION}" /pdlua
--volume ./pdlua-${os}:/pdlua registry.git.iem.at/pd/deken \
deken upload --no-source-error -v "${VERSION}" /pdlua
done
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD \
--volume ./pdlua-src:/pdlua registry.git.iem.at/pd/deken \
deken upload -v "${VERSION}" /pdlua

0 comments on commit 00280e9

Please sign in to comment.