This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 23d20c3
Showing
15 changed files
with
3,357 additions
and
0 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,3 @@ | ||
target | ||
.git | ||
.github |
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,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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,125 @@ | ||
# Matrix based on examples from: | ||
# https://github.com/svenstaro/miniserve/blob/master/.github/workflows/publish.yml | ||
|
||
name: Build and deploy to Azure | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'release-*' | ||
|
||
env: | ||
AZURE_FUNCTIONAPP_NAME: bc-totorobot | ||
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.target }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-musl | ||
#- x86_64-apple-darwin | ||
|
||
include: | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
artifact_name: target/x86_64-unknown-linux-musl/release/totorobot | ||
release_name: linux-x86_64-musl | ||
build_with: musl | ||
build_command: docker run -v $PWD:/volume --rm -t clux/muslrust cargo build --release | ||
strip: true | ||
|
||
# - os: macos-latest | ||
# target: x86_64-apple-darwin | ||
# artifact_name: target/x86_64-apple-darwin/release/totorobot | ||
# release_name: macos-x86_64 | ||
# build_with: nightly | ||
# build_command: cargo build --release | ||
# strip: true | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
if: matrix.build_with == ('stable' || 'nightly') | ||
with: | ||
toolchain: ${{ matrix.build_with }} | ||
target: ${{ matrix.target }} | ||
|
||
- name: Set up muslrust container | ||
uses: docker://clux/muslrust:nightly | ||
if: matrix.build_with == 'musl' | ||
|
||
- name: Build totorobot | ||
run: ${{ matrix.build_command }} | ||
|
||
- name: Copy binary to bin directory | ||
run: | | ||
mkdir bin | ||
cp ${{ matrix.artifact_name }} bin/ | ||
- name: Compress binary | ||
uses: svenstaro/upx-action@v2 | ||
with: | ||
file: bin/totorobot | ||
args: --lzma | ||
strip: ${{ matrix.strip }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: totorobot-${{ matrix.release_name }} | ||
path: | | ||
${{ github.workspace}} | ||
!.git* | ||
!Cargo* | ||
!src/ | ||
!target/ | ||
- name: Upload to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: bin/totorobot | ||
asset_name: totorobot-${{ matrix.release_name }} | ||
tag: ${{ github.ref }} | ||
|
||
azure-deploy: | ||
name: Deploy to Azure | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login via Azure CLI | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Download release artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: totorobot-linux-x86_64-musl | ||
|
||
- name: Setup Bicep | ||
uses: anthony-c-martin/[email protected] | ||
|
||
- name: Build Bicep | ||
run: bicep build main.bicep | ||
|
||
- name: Deploy Azure resources | ||
uses: azure/arm-deploy@v1 | ||
with: | ||
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
resourceGroupName: bc-totorobot | ||
template: ./main.json | ||
parameters: TOTORO_MAILCHIMP_APIKEY=${{ secrets.TOTORO_MAILCHIMP_APIKEY }} TOTORO_MAILCHIMP_LIST_ID=${{ secrets.TOTORO_MAILCHIMP_LIST_ID }} TOTORO_BASECAMP_BOTURL=${{ secrets.TOTORO_BASECAMP_BOTURL }} | ||
|
||
- name: Deploy Azure Function | ||
uses: Azure/functions-action@v1 | ||
with: | ||
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} |
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,57 @@ | ||
on: [push, pull_request] | ||
|
||
name: Lints | ||
|
||
jobs: | ||
clippy: | ||
name: Format + Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
tests: | ||
name: Unit tests | ||
needs: clippy | ||
runs-on: ubuntu-latest | ||
env: | ||
TOTORO_MAILCHIMP_APIKEY: ${{ secrets.TOTORO_MAILCHIMP_APIKEY }} | ||
TOTORO_MAILCHIMP_LIST_ID: ${{ secrets.TOTORO_MAILCHIMP_LIST_ID }} | ||
# Placeholder only for Basecamp URL because a real call is not | ||
# actually made in test mode | ||
TOTORO_BASECAMP_BOTURL: example | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test |
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,14 @@ | ||
# Rust builds | ||
/target | ||
|
||
# Mac cruft | ||
.DS_Store | ||
|
||
# Bicep generated files | ||
main.json | ||
|
||
# Azure functions | ||
local.settings.json | ||
|
||
# Totorobot | ||
totorobot |
Oops, something went wrong.