Add rustix #236
Workflow file for this run
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
name: Blessed.rs | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
jobs: | |
build: | |
name: Compile binary | |
# We compile the binary natively on the CI operating system, and then copy into a docker container and expect it to run. | |
# This can cause issues (binary won't run at all) if the glibc version of the OS the compilation happens on is newer than | |
# the glibc version of the OS running inside the docker container. | |
# | |
# To be safe, the OS version here should be kept to an older version than the OS version in the Dockerfile | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Restore rust compilation cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Compile release build | |
run: cargo build --release --all-features | |
- name: Upload binary as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: blessed-rs-release-binary | |
path: target/release/blessed-rs | |
deploy_flyio: | |
name: Deploy to Fly.io | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
concurrency: production_environment | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download binary artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: blessed-rs-release-binary | |
path: target/release | |
- name: Setup flyctl | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy to Fly.io | |
run: flyctl deploy --remote-only |