name: build
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add hosts
run: |
echo "159.138.147.37 api.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 api.gitcode.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.gitcode.com" | sudo tee -a /etc/hosts
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Add macOS targets
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Build ARM64
run: cargo build --release --target aarch64-apple-darwin
- name: Build x86_64
run: cargo build --release --target x86_64-apple-darwin
- name: Prepare binaries
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
mkdir -p dist
cp target/aarch64-apple-darwin/release/atomcode dist/atomcode-${TAG_NAME}-darwin-arm64
cp target/x86_64-apple-darwin/release/atomcode dist/atomcode-${TAG_NAME}-darwin-x64
chmod +x dist/*
- name: Strip binaries
run: |
strip dist/* || true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Upload ARM64
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-darwin-arm64 \
--file-path=dist/atomcode-${TAG_NAME}-darwin-arm64 \
--access-token=${{ secrets.ACCESS_TOKEN }}
- name: Upload x86_64
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-darwin-x64 \
--file-path=dist/atomcode-${TAG_NAME}-darwin-x64 \
--access-token=${{ secrets.ACCESS_TOKEN }}
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add hosts
run: |
echo "159.138.147.37 api.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 api.gitcode.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.gitcode.com" | sudo tee -a /etc/hosts
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Add Linux targets
run: |
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
- name: Build x86_64
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Build ARM64
run: cargo build --release --target aarch64-unknown-linux-gnu
env:
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Prepare binaries
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
mkdir -p dist
cp target/x86_64-unknown-linux-gnu/release/atomcode dist/atomcode-${TAG_NAME}-linux-x64
cp target/aarch64-unknown-linux-gnu/release/atomcode dist/atomcode-${TAG_NAME}-linux-arm64
chmod +x dist/*
- name: Strip binaries
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
strip dist/atomcode-${TAG_NAME}-linux-x64 || true
aarch64-linux-gnu-strip dist/atomcode-${TAG_NAME}-linux-arm64 || true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Upload x86_64
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-linux-x64 \
--file-path=dist/atomcode-${TAG_NAME}-linux-x64 \
--access-token=${{ secrets.ACCESS_TOKEN }}
- name: Upload ARM64
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-linux-arm64 \
--file-path=dist/atomcode-${TAG_NAME}-linux-arm64 \
--access-token=${{ secrets.ACCESS_TOKEN }}
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add hosts
run: |
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "159.138.147.37 api.atomgit.com"
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "159.138.147.37 file.atomgit.com"
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "159.138.147.37 api.gitcode.com"
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "159.138.147.37 file.gitcode.com"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Add Windows targets
run: |
rustup target add aarch64-pc-windows-msvc
# x86_64 is usually available by default on windows-latest, but keep
# it explicit so the release matrix is self-documenting and stable.
rustup target add x86_64-pc-windows-msvc
- name: Build ARM64
run: cargo build --release --target aarch64-pc-windows-msvc
- name: Build x86_64
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Prepare binaries
shell: bash
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
mkdir -p dist
cp target/aarch64-pc-windows-msvc/release/atomcode.exe dist/atomcode-${TAG_NAME}-windows-arm64.exe
cp target/x86_64-pc-windows-msvc/release/atomcode.exe dist/atomcode-${TAG_NAME}-windows-x64.exe
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Upload ARM64
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-windows-arm64.exe \
--file-path=dist/atomcode-${TAG_NAME}-windows-arm64.exe \
--access-token=${{ secrets.ACCESS_TOKEN }}
- name: Upload x86_64
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python3 .github/workflows/create_tag_release.py \
--tag-name=${TAG_NAME} \
--file-name=atomcode-${TAG_NAME}-windows-x64.exe \
--file-path=dist/atomcode-${TAG_NAME}-windows-x64.exe \
--access-token=${{ secrets.ACCESS_TOKEN }}
distro-pm-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add hosts
run: |
echo "159.138.147.37 api.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.atomgit.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 api.gitcode.com" | sudo tee -a /etc/hosts
echo "159.138.147.37 file.gitcode.com" | sudo tee -a /etc/hosts
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build with distro-pm feature
run: cargo build -p atomcode --features distro-pm
- name: Test distro-pm gating
run: cargo test -p atomcode-core --lib --features distro-pm self_update::tests