build #132
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: Build | |
run-name: build | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
CARGO_INCREMENTAL: "0" | |
DATABASE_URL: "sqlite://docker-build.db?mode=rwc" | |
REGISTRY_USER: ${{ github.actor }} | |
REGISTRY_PASSWORD: ${{ github.token }} | |
IMAGE_REGISTRY: ghcr.io | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: musl-tools g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix protobuf-compiler libapparmor-dev libdevmapper-dev libglib2.0-dev libgpgme-dev libseccomp-dev libselinux1-dev netavark gcc-aarch64-linux-gnu | |
version: 1.3 | |
- run: sudo ln -sfv /usr/bin/x86_64-w64-mingw32-gcc-posix /usr/bin/x86_64-w64-mingw32-gcc | |
- run: sudo ln -sfv /usr/bin/x86_64-w64-mingw32-g++-posix /usr/bin/x86_64-w64-mingw32-g++ | |
- run: wget http://ports.ubuntu.com/ubuntu-ports/ubuntu-ports/pool/universe/m/musl/musl-dev_1.2.4-2_arm64.deb | |
- run: wget http://ports.ubuntu.com/ubuntu-ports/ubuntu-ports/pool/universe/m/musl/musl_1.2.4-2_arm64.deb | |
- run: sudo dpkg -i --force architecture musl_1.2.4-2_arm64.deb | |
- run: sudo dpkg -i --force architecture --force depends musl-dev_1.2.4-2_arm64.deb | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Run sccache-cache | |
uses: mozilla-actions/sccache-action@v0.0.4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: cargo install sqlx-cli --no-default-features --features rustls,sqlite | |
- run: sqlx migrate run | |
- run: cargo build --profile release-lto --target aarch64-unknown-linux-musl | |
env: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-ld | |
- run: cargo build --profile release-lto --target x86_64-unknown-linux-musl | |
- run: cargo build --profile release-lto --target x86_64-pc-windows-gnu | |
- run: | | |
mkdir build | |
mv target/aarch64-unknown-linux-musl/release-lto/meshstellar build/meshstellar-linux-aarch64 | |
mv target/x86_64-unknown-linux-musl/release-lto/meshstellar build/meshstellar-linux-x86_64 | |
mv target/x86_64-pc-windows-gnu/release-lto/meshstellar.exe build/meshstellar-windows-x86_64.exe | |
mv meshstellar.toml.example build | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: | | |
build | |
build-container: | |
needs: build | |
runs-on: ubuntu-24.04 | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: musl-tools g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix protobuf-compiler libapparmor-dev libdevmapper-dev libglib2.0-dev libgpgme-dev libseccomp-dev libselinux1-dev netavark gcc-aarch64-linux-gnu | |
version: 1.3 | |
- name: Check out Containerfiles | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
Containerfile.github | |
Containerfile-arm64.github | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Log in to ghcr.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
- name: Upgrade Buildah | |
run: | | |
git clone -b v1.36.0 --depth=1 https://github.com/containers/buildah.git ~/go/src/github.com/containers/buildah | |
pushd ~/go/src/github.com/containers/buildah | |
make buildah docs | |
sudo make install | |
buildah version | |
popd | |
- name: Upgrade crun | |
run: | | |
wget https://github.com/containers/crun/releases/download/${VERSION}/crun-${VERSION}-linux-amd64-disable-systemd | |
chmod a+x crun-${VERSION}-linux-amd64-disable-systemd | |
sudo mv crun-${VERSION}-linux-amd64-disable-systemd /usr/bin/crun | |
env: | |
VERSION: 1.15 | |
- run: sudo buildah build --tag ghcr.io/jurriaan/meshstellar:${{ github.sha }}-amd64 --platform linux/amd64 -f Containerfile.github . | |
- run: sudo buildah build --tag ghcr.io/jurriaan/meshstellar:${{ github.sha }}-arm64 --platform linux/arm64 -f Containerfile-arm64.github . | |
- run: sudo buildah push ghcr.io/jurriaan/meshstellar:${{ github.sha }}-amd64 | |
- run: sudo buildah push ghcr.io/jurriaan/meshstellar:${{ github.sha }}-arm64 | |
- run: sudo buildah manifest create ghcr.io/jurriaan/meshstellar:${{ github.sha }} ghcr.io/jurriaan/meshstellar:${{ github.sha }}-amd64 ghcr.io/jurriaan/meshstellar:${{ github.sha }}-arm64 | |
- run: sudo buildah manifest push --all ghcr.io/jurriaan/meshstellar:${{ github.sha }} | |
- run: sudo buildah manifest create ghcr.io/jurriaan/meshstellar:latest ghcr.io/jurriaan/meshstellar:${{ github.sha }}-amd64 ghcr.io/jurriaan/meshstellar:${{ github.sha }}-arm64 | |
- run: sudo buildah manifest push --all ghcr.io/jurriaan/meshstellar:latest | |