Skip to content

Artifacts

Artifacts #7

Workflow file for this run

name: Artifacts
on:
push:
branches:
- main
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
binary_linux:
runs-on: ubuntu-20.04
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup and select the target architectures
run: rustup update && rustup target add aarch64-unknown-linux-gnu
- name: Update the system and install the aarch64 compiler
run: |
sudo apt update && sudo apt install -y g++-aarch64-linux-gnu
echo -e "\n\n[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Build the release version of `shex-rs` for the aarch64 architecture
run: cargo build --release --target aarch64-unknown-linux-gnu
env:
BINDGEN_EXTRA_CLANG_ARGS: --sysroot /usr/aarch64-linux-gnu
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_linux_gnu
path: target/release/${{ vars.BINARY_NAME }}
- name: Upload the generated Artifact for it to be stored in its corresponding release (aarch64)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_aarch64-linux_gnu
path: target/aarch64-unknown-linux-gnu/release/${{ vars.BINARY_NAME }}
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_linux_gnu
if: github.event_name == 'release'
- name: Rename the binary according to the version and architecture
run: mv target/aarch64-unknown-linux-gnu/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_linux_gnu
if: github.event_name == 'release'
- name: Upload the generated binaries to their corresponding release
uses: softprops/action-gh-release@v1
with:
files: |
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_linux_gnu
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_linux_gnu
if: github.event_name == 'release'
binary_mac:
runs-on: macos-latest
env:
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer'
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
MACOSX_DEPLOYMENT_TARGET: '10.14'
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup and select the target architectures
run: rustup update && rustup target add aarch64-apple-darwin
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Build the release version of `shex-rs` for the aarch64 architecture
run: cargo build --release --target aarch64-apple-darwin
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_apple
path: target/release/${{ vars.BINARY_NAME }}
- name: Upload the generated Artifact for it to be stored in its corresponding release (aarch64)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_aarch64_apple
path: target/aarch64-apple-darwin/release/${{ vars.BINARY_NAME }}
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_apple
if: github.event_name == 'release'
- name: Rename the binary according to the version and architecture
run: mv target/aarch64-apple-darwin/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_apple
if: github.event_name == 'release'
- name: Upload the generated binaries to their corresponding release
uses: softprops/action-gh-release@v1
with:
files: |
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_apple
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_apple
if: github.event_name == 'release'
binary_windows:
runs-on: windows-latest
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup
run: rustup update
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Remove the MySys64 libraries and utilities
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_windows_msvc
path: target/release/${{ vars.BINARY_NAME }}.exe
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }}.exe ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe
if: github.event_name == 'release'
- name: Upload the generated binary to its corresponding release
uses: softprops/action-gh-release@v1
with:
files: ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe
if: github.event_name == 'release'
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_CONTAINER }}:latest