-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pull gateway_mfr build from upstream to reduce build time
- pull gateway_mfr build from upstream - update pypi and test-pypi actions - add action to check gateway-mfr-rs version weekly and auto-update if necessary - remove old unused backup action Closes: #43
- Loading branch information
Showing
4 changed files
with
113 additions
and
168 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,47 +3,9 @@ name: Publish Python 🐍 distribution 📦 to TestPyPI | |
on: [push] | ||
|
||
jobs: | ||
rust-compile: | ||
name: Build gateway-mfr-rs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: arm-unknown-linux-gnueabihf | ||
override: true | ||
|
||
- name: Clone repo | ||
run: | | ||
git clone --branch v0.1.5 https://github.com/helium/gateway-mfr-rs.git . | ||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: check | ||
|
||
- name: Build gateway-mfr-rs | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --target arm-unknown-linux-gnueabihf --release | ||
|
||
- name: Copy release file | ||
run: | | ||
cp ./target/arm-unknown-linux-gnueabihf/release/gateway_mfr gateway_mfr | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: gateway_mfr | ||
path: ./gateway_mfr | ||
|
||
build-n-publish: | ||
name: Build and publish Python 🐍 distribution 📦 to TestPyPI | ||
runs-on: ubuntu-18.04 | ||
needs: [rust-compile] | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
|
@@ -53,18 +15,33 @@ jobs: | |
with: | ||
python-version: 3.7 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: gateway_mfr | ||
path: ./gateway_mfr | ||
|
||
- name: Move gateway_mfr in place | ||
- name: Fetch gateway-mfr-rs | ||
env: | ||
GATEWAY_MFR_RS_RELEASE: v0.1.6 | ||
run: | | ||
chmod +x gateway_mfr/gateway_mfr | ||
wget "https://github.com/helium/gateway-mfr-rs/releases/download/${GATEWAY_MFR_RS_RELEASE}/gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" | ||
wget "https://github.com/helium/gateway-mfr-rs/releases/download/${GATEWAY_MFR_RS_RELEASE}/gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.checksum" | ||
SHA256=$( shasum -a 256 "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" ) | ||
# Verify the checksum | ||
if grep -q "${SHA256}" "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.checksum"; then | ||
echo "Checksum verified for gateway_mfr." | ||
exit 0 | ||
else | ||
echo "Checksum does not match. Please check download manually and rerun!" | ||
exit 1 | ||
fi | ||
# Unpack the tarball | ||
tar -xvf "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" | ||
- name: Change permissions on gateway_mfr | ||
run: | | ||
chmod +x gateway_mfr | ||
- name: Move gateway_mfr in place | ||
run: | | ||
mv gateway_mfr/gateway_mfr hm_pyhelper/ | ||
mv gateway_mfr hm_pyhelper/ | ||
- name: Install pypa/build | ||
run: | | ||
|
@@ -79,10 +56,6 @@ jobs: | |
name: wheels | ||
path: ./dist/* | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/[email protected] | ||
|
||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
|
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 |
---|---|---|
|
@@ -6,47 +6,9 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
rust-compile: | ||
name: Build gateway-mfr-rs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: arm-unknown-linux-gnueabihf | ||
override: true | ||
|
||
- name: Clone repo | ||
run: | | ||
git clone --branch v0.1.5 https://github.com/helium/gateway-mfr-rs.git . | ||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: check | ||
|
||
- name: Build gateway-mfr-rs | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --target arm-unknown-linux-gnueabihf --release | ||
|
||
- name: Copy release file | ||
run: | | ||
cp ./target/arm-unknown-linux-gnueabihf/release/gateway_mfr gateway_mfr | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: gateway_mfr | ||
path: ./gateway_mfr | ||
|
||
build-n-publish: | ||
name: Build and publish Python 🐍 distribution 📦 to PyPI | ||
runs-on: ubuntu-18.04 | ||
needs: [rust-compile] | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
|
@@ -56,18 +18,33 @@ jobs: | |
with: | ||
python-version: 3.7 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: gateway_mfr | ||
path: ./gateway_mfr | ||
- name: Fetch gateway-mfr-rs | ||
env: | ||
GATEWAY_MFR_RS_RELEASE: v0.1.6 | ||
run: | | ||
wget "https://github.com/helium/gateway-mfr-rs/releases/download/${GATEWAY_MFR_RS_RELEASE}/gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" | ||
wget "https://github.com/helium/gateway-mfr-rs/releases/download/${GATEWAY_MFR_RS_RELEASE}/gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.checksum" | ||
SHA256=$( shasum -a 256 "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" ) | ||
# Verify the checksum | ||
if grep -q "${SHA256}" "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.checksum"; then | ||
echo "Checksum verified for gateway_mfr." | ||
exit 0 | ||
else | ||
echo "Checksum does not match. Please check download manually and rerun!" | ||
exit 1 | ||
fi | ||
# Unpack the tarball | ||
tar -xvf "gateway-mfr-${GATEWAY_MFR_RS_RELEASE}-arm-unknown-linux-gnueabihf.tar.gz" | ||
- name: Move gateway_mfr in place | ||
- name: Change permissions on gateway_mfr | ||
run: | | ||
chmod +x gateway_mfr/gateway_mfr | ||
chmod +x gateway_mfr | ||
- name: Move gateway_mfr in place | ||
run: | | ||
mv gateway_mfr/gateway_mfr hm_pyhelper/ | ||
mv gateway_mfr hm_pyhelper/ | ||
- name: Install pypa/build | ||
run: | | ||
|
@@ -81,7 +58,7 @@ jobs: | |
with: | ||
name: wheels | ||
path: ./dist/* | ||
|
||
- name: Get Latest Release | ||
id: latest_version | ||
uses: abatilo/[email protected] | ||
|
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,67 @@ | ||
name: Check if we're using the latest Gateway MFR (gateway-mfr-rs) release | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * 0" # Run weekly on sunday | ||
workflow_dispatch: | ||
|
||
jobs: | ||
latest-version: | ||
name: Get Latest Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Get Latest Release | ||
id: latest_version | ||
uses: abatilo/[email protected] | ||
with: | ||
owner: helium | ||
repo: gateway-mfr-rs | ||
- name: Perform check and update | ||
env: | ||
GATEWAY_MFR_RS_RELEASE: ${{ steps.latest_version.outputs.latest_tag }} | ||
run: | | ||
GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) | ||
CHECK_LATEST_RELEASE="GATEWAY_MFR_RS_RELEASE: ${GATEWAY_MFR_RS_RELEASE}" | ||
echo "GATEWAY_MFR_RS_RELEASE=$GATEWAY_MFR_RS_RELEASE" >> $GITHUB_ENV | ||
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV | ||
# Get the latest gateway-mfr-rs release | ||
if grep -q "$CHECK_LATEST_RELEASE" .github/workflows/publish-to-pypi-test.yml; then | ||
echo "We're on the latest Helium gateway-mfr-rs release $GATEWAY_MFR_RS_RELEASE." | ||
exit 0 | ||
else | ||
echo "We're not on the latest Helium gateway-mfr-rs release. Updating to $GATEWAY_MFR_RS_RELEASE." | ||
sed -i -E 's/GATEWAY_MFR_RS_RELEASE: v.*/GATEWAY_MFR_RS_RELEASE: '$GATEWAY_MFR_RS_RELEASE'/g' .github/workflows/publish-to-pypi-test.yml | ||
sed -i -E 's/GATEWAY_MFR_RS_RELEASE: v.*/GATEWAY_MFR_RS_RELEASE: '$GATEWAY_MFR_RS_RELEASE'/g' .github/workflows/publish-to-pypi.yml | ||
UPDATED=true | ||
echo "UPDATED=$UPDATED" >> $GITHUB_ENV | ||
exit 0 | ||
fi | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: Update gateway-mfr-rs to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }} | ||
branch: gateway-mfr-rs/${{ env.GATEWAY_MFR_RS_RELEASE }} | ||
delete-branch: true | ||
base: master | ||
title: "gateway-mfr-rs: Update to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }}" | ||
body: | | ||
Update gateway-mfr-rs to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }} | ||
Ref https://github.com/helium/gateway-mfr-rs/releases/tag/${{ env.GATEWAY_MFR_RS_RELEASE }} | ||
draft: false | ||
- name: Report Status | ||
if: env.UPDATED == 'true' | ||
uses: ravsamhq/notify-slack-action@master | ||
with: | ||
status: ${{ job.status }} | ||
notification_title: 'Gateway-mfr-rs has been updated to ${{ env.GATEWAY_MFR_RS_RELEASE }}. Please review PR!' | ||
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>' | ||
footer: '<{run_url}|View Run> | Linked Repo <{repo_url}|{repo}> | <{workflow_url}|View Workflow>' | ||
mention_groups: 'S02GCFWL27R' | ||
notify_when: 'success' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.MINER_MONITORING_SLACK }} |