-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcaa236
commit 925ef47
Showing
9 changed files
with
281 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: 'Compile libfibre' | ||
description: 'Compiles libfibre for the specified target' | ||
inputs: | ||
target: | ||
description: | | ||
The build target on which the compiled libfibre is supposed to run. | ||
Supported values are: | ||
- local (the runner must be ubuntu-latest) | ||
required: true | ||
default: local | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Prerequisites | ||
shell: bash | ||
run: | | ||
UNAME=$(uname) | ||
if [ "$UNAME" == "Linux" ]; then | ||
echo "installing tup..." | ||
if ! (apt-cache search tup | grep "^tup - "); then | ||
sudo add-apt-repository ppa:jonathonf/tup | ||
sudo apt-get update | ||
fi | ||
sudo apt-get install tup | ||
echo "installing interface_generator dependencies..." | ||
sudo apt install python3 python3-yaml python3-jinja2 python3-jsonschema | ||
echo "installing fibre-cpp build dependencies..." | ||
sudo apt-get install libusb-1.0-0-dev | ||
elif [ "$UNAME" == "Darwin" ]; then | ||
echo "installing tup..." | ||
brew cask install osxfuse && brew install tup | ||
echo "installing interface_generator dependencies..." | ||
pip3 install PyYAML Jinja2 jsonschema | ||
echo "installing fibre-cpp build dependencies..." | ||
# libusb already installed | ||
#brew install libusb | ||
pkg-config libusb-1.0 --cflags | ||
elif [ "$UNAME" == "CYGWIN*" ] || [ "$UNAME" == "MINGW*" ] ; then | ||
# # TODO: fix this | ||
# echo "installing tup..." | ||
# Invoke-WebRequest -Uri "http://gittup.org/tup/win32/tup-latest.zip" -OutFile ".\tup-latest.zip" | ||
# Expand-Archive ".\tup-latest.zip" -DestinationPath ".\tup-latest" -Force | ||
# echo "$(Resolve-Path .)\tup-latest" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
# echo "installing interface_generator dependencies..." | ||
# pip install PyYAML Jinja2 jsonschema | ||
# echo "installing fibre-cpp build dependencies..." | ||
# Invoke-WebRequest -Uri "https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z" -OutFile ".\libusb-1.0.23.7z" | ||
# & "$env:ProgramFiles\7-Zip\7z.exe" x -o".\libusb-1.0.23" ".\libusb-1.0.23.7z" -r ; | ||
# #Expand-Archive ".\libusb-1.0.23.7z" -DestinationPath ".\libusb-1.0.23" -Force | ||
# dir | ||
# echo 'CONFIG_LDFLAGS="./libusb-1.0.23/MinGW64/static/libusb-1.0.a"' | Out-File -FilePath "tup.config" -Encoding utf8 -Append | ||
echo "not implemented" | ||
return 1 | ||
else | ||
echo "Unknown operating system: $UNAME" | ||
return 1 | ||
fi | ||
- name: Compile | ||
shell: bash | ||
run: | | ||
tup init | ||
tup generate ./tup_build.sh | ||
./tup_build.sh | ||
# # This is required to make the action repeatable | ||
# - name: Clean up | ||
# shell: bash | ||
# run: git clean -dffx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Nightly Releases | ||
|
||
# TODO: use schedule | ||
on: | ||
push: | ||
branches: [fix-ci] | ||
|
||
jobs: | ||
create_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare Release | ||
id: release_specs | ||
run: | | ||
BODY="This prerelease was autogenerated from the \`devel\` branch on $(date --iso). \ | ||
It should not be expected to be stable. \ | ||
If some binaries are missing then it is probably because the build \ | ||
failed for those binaries." | ||
# Escape BODY string to set it as GitHub Actions output | ||
BODY="${BODY//'%'/'%25'}" | ||
BODY="${BODY//$'\n'/'%0A'}" | ||
BODY="${BODY//$'\r'/'%0D'}" | ||
echo "::set-output name=title::Nightly Build $(date --iso)" | ||
echo "::set-output name=body::$BODY" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ steps.release_specs.outputs.title }} | ||
body: ${{ steps.release_specs.outputs.body }} | ||
draft: true | ||
prerelease: true | ||
|
||
- name: Print URL | ||
run: | | ||
echo "URL: ${{ steps.create_release.outputs.upload_url }}" | ||
echo "ref: ${{ github.ref }}" | ||
create_assets: | ||
needs: create_release | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- {os: ubuntu-latest, target: local} | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ./.github/actions/compile | ||
with: | ||
target: ${{ matrix.local }} | ||
|
||
- name: Upload Binary | ||
shell: bash | ||
run: | | ||
COMMIT="$GITHUB_SHA" | ||
echo "commit hash: $COMMIT" | ||
RELEASES="$(curl --silent --show-error --fail \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/samuelsadok/fibre/releases")" | ||
upload_url="$(echo "$RELEASES" | jq -r '.[] | select(.target_commitish == "'$COMMIT'") | .upload_url')" | ||
echo "upload_url: $upload_url" | ||
BINARY="$(ls cpp | grep "libfibre-" | head)" | ||
URL="$(echo "$upload_url" | sed 's/assets.*$/assets/')?name=$BINARY" | ||
echo "uploading $BINARY to $URL" >&2 | ||
curl --silent --show-error --fail \ | ||
-H "Content-Type: application/octet-stream" \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
--data-binary @"cpp/$BINARY" \ | ||
"$URL" | ||
finalize_release: | ||
needs: create_assets | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Publish Release | ||
shell: bash | ||
run: | | ||
COMMIT="$GITHUB_SHA" | ||
echo "commit hash: $COMMIT" | ||
RELEASES="$(curl --silent --show-error --fail \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/samuelsadok/fibre/releases")" | ||
id="$(echo "$RELEASES" | jq -r '.[] | select(.target_commitish == "'$COMMIT'") | .id')" | ||
echo "release id: $id" | ||
curl --silent --show-error --fail \ | ||
-X PATCH \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-d '{"draft":false}' \ | ||
"https://api.github.com/repos/samuelsadok/fibre/releases/$id" | ||
# TODO: delete old nightly releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.