Skip to content

setup xtask infra for cheatsheets #1011

setup xtask infra for cheatsheets

setup xtask infra for cheatsheets #1011

Workflow file for this run

name: Build sample material
on:
schedule:
- cron: '0 0 * * Mon'
push:
pull_request:
jobs:
build-slides:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: mdbook@0.4.42,mdbook-graphviz@0.2.1
- name: Add mdslides
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrous-systems/mdslides/releases/download/v0.5.0/mdslides-installer.sh | sh
- name: Add graphviz
run: |
sudo apt-get update -y && sudo apt-get install -y graphviz
- name: Update Rust
run: |
rustup update stable
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build book-and-slides
run: |
cd ./training-slides && ./build.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
mv ./training-slides/slides ./rust-training-${{ env.slug }}/training-slides-presentation
mv ./training-slides/book ./rust-training-${{ env.slug }}/training-slides-book
cp -r ./example-code ./rust-training-${{ env.slug }}
echo "Compressing ./rust-training-${{ env.slug }}.zip..."
zip -r ./rust-training-${{ env.slug }}.zip ./rust-training-${{ env.slug }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Slides
if-no-files-found: error
path: |
./rust-training-*/
- name: Create and Upload Release
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: ./rust-training-${{ env.slug }}.zip
build-slides-weekly-beta:
runs-on: ubuntu-20.04
if: needs.pr-check.outputs.number != null
steps:
- uses: actions/checkout@v4
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: mdbook@0.4.42,mdbook-graphviz@0.2.1
- name: Add mdslides
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrous-systems/mdslides/releases/download/v0.5.0/mdslides-installer.sh | sh
- name: Add graphviz
run: |
sudo apt-get update -y && sudo apt-get install -y graphviz
- name: Update Beta Rust
run: |
rustup update beta
rustup default beta
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build book-and-slides
run: |
cd ./training-slides && ./build.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
mv ./training-slides/slides ./rust-training-${{ env.slug }}/training-slides-presentation
mv ./training-slides/book ./rust-training-${{ env.slug }}/training-slides-book
cp -r ./example-code ./rust-training-${{ env.slug }}
echo "Compressing ./rust-training-${{ env.slug }}.zip..."
zip -r ./rust-training-${{ env.slug }}.zip ./rust-training-${{ env.slug }}
build-slides-weekly-nightly:
runs-on: ubuntu-20.04
if: needs.pr-check.outputs.number != null
steps:
- uses: actions/checkout@v4
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: mdbook@0.4.42,mdbook-graphviz@0.2.1
- name: Add mdslides
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrous-systems/mdslides/releases/download/v0.5.0/mdslides-installer.sh | sh
- name: Add graphviz
run: |
sudo apt-get update -y && sudo apt-get install -y graphviz
- name: Update Nightly Rust
run: |
rustup update nightly
rustup default nightly
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build book-and-slides
run: |
cd ./training-slides && ./build.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
mv ./training-slides/slides ./rust-training-${{ env.slug }}/training-slides-presentation
mv ./training-slides/book ./rust-training-${{ env.slug }}/training-slides-book
cp -r ./example-code ./rust-training-${{ env.slug }}
echo "Compressing ./rust-training-${{ env.slug }}.zip..."
zip -r ./rust-training-${{ env.slug }}.zip ./rust-training-${{ env.slug }}
build-examples-ferrocene:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install Critical Up
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ferrocene/criticalup/releases/download/v1.1.0/criticalup-installer.sh | sh
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build example code
env:
CRITICALUP_TOKEN: ${{ secrets.CRITICALUP_TOKEN }}
run: |
cd ./example-code && ./build-ferrocene.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
cp -r ./example-code ./rust-training-${{ env.slug }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Ferrocene Examples
if-no-files-found: error
path: |
./rust-training-*/
build-examples:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Add Rust Targets and Tools
run: |
rustup target add thumbv7em-none-eabihf
rustup target add thumbv7em-none-eabi
rustup target add armv7r-none-eabihf
rustup target add aarch64-unknown-none
rustup component add llvm-tools-preview
- name: Find slug name
run: |
slug=$(./describe.sh "${GITHUB_REF}")
echo "Building with slug '${slug}'"
echo "slug=${slug}" >> "${GITHUB_ENV}"
- name: Build example code
run: |
cd ./example-code && ./build.sh
- name: Assemble Artifacts
run: |
echo "Making ./rust-training-${{ env.slug }}..."
mkdir -p ./rust-training-${{ env.slug }}
cp -r ./example-code ./rust-training-${{ env.slug }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Examples
if-no-files-found: error
path: |
./rust-training-*/
build-windows-examples:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Update Rust
run: |
rustup update stable
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build FFI Example
run: |
cd example-code\native\ffi\use-rust-in-c\windows-example
msbuild.exe windows-example.sln /p:Configuration=Debug
.\x64\Debug\windows-example.exe
msbuild.exe windows-example.sln /p:Configuration=Release
.\x64\Release\windows-example.exe