Readme #133
This file contains hidden or 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: Release | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
PROJECT_NAME: http-server | |
JUST_VERSION: "1.36.0" | |
jobs: | |
test: | |
name: π§ͺ Test | |
runs-on: ubuntu-24.04 | |
steps: | |
- { uses: actions/checkout@v4, with: { submodules: true } } | |
- run: source ./.github/install-scripts/just/main.ps1 | |
- run: source ./.github/install-scripts/rust/main.ps1 | |
- run: just test | |
format: | |
name: π Format | |
runs-on: ubuntu-24.04 | |
steps: | |
- { uses: actions/checkout@v4, with: { submodules: true } } | |
- run: source ./.github/install-scripts/just/main.ps1 | |
- run: source ./.github/install-scripts/rust/main.ps1 | |
- run: just fmt | |
lint: | |
name: π€ Lint | |
runs-on: ubuntu-24.04 | |
steps: | |
- { uses: actions/checkout@v4, with: { submodules: true } } | |
- run: source ./.github/install-scripts/just/main.ps1 | |
- run: source ./.github/install-scripts/rust/main.ps1 | |
- run: just lint | |
build: | |
strategy: | |
matrix: | |
config: | |
- name: π₯ Linux AMD64 | |
os: linux | |
arch: amd64 | |
runner: ubuntu-24.04 | |
run: rustup target add x86_64-unknown-linux-musl | |
- name: π₯ Linux ARM64 | |
os: linux | |
arch: arm64 | |
runner: ubuntu-24.04-arm | |
run: rustup target add aarch64-unknown-linux-musl | |
- name: π MacOS AMD64 | |
os: macos | |
arch: amd64 | |
runner: macos-13 | |
- name: π MacOS ARM64 | |
os: macos | |
arch: arm64 | |
runner: macos-15 | |
- name: π¦ Windows AMD64 | |
os: windows | |
arch: amd64 | |
runner: windows-latest | |
- name: π¦ Windows ARM64 | |
os: windows | |
arch: arm64 | |
runner: windows-latest | |
run: rustup target add aarch64-pc-windows-msvc | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.runner }} | |
steps: | |
- { uses: actions/checkout@v4, with: { submodules: true } } | |
- run: . ./.github/install-scripts/just/main.ps1 | |
- run: . ./.github/install-scripts/rust/main.ps1 | |
- if: matrix.config.run | |
run: ${{ matrix.config.run }} | |
- env: | |
os: "${{ matrix.config.os }}" | |
arch: "${{ matrix.config.arch }}" | |
profile: "release" | |
run: just build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_NAME }}-${{ matrix.config.os }}-${{ matrix.config.arch }} | |
path: ${{ github.workspace }}/target/${{ matrix.config.os }}-${{ matrix.config.arch }}/**/* | |
if-no-files-found: error | |
retention-days: 1 | |
publish-github-release: | |
name: "π Publish Github Release" | |
runs-on: ubuntu-24.04 | |
needs: | |
- test | |
- format | |
- lint | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: { path: artifacts } | |
- name: Publish` Github Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -e | |
TAG="$(date -u +"v%Y.%m.%d.%H%M").${GITHUB_SHA::4}" | |
echo "Tag: ${TAG}" | |
gh release create $TAG --draft --notes "Automatically built binaries" | |
gh release edit $TAG --title "π Latest" | |
cd artifacts | |
for name in *; do | |
cd "${{ github.workspace }}/artifacts/${name}/release" | |
tar -czvf ./${name}.tar.gz ./* | |
gh release upload $TAG ${name}.tar.gz | |
done | |
gh release edit $TAG --draft=false |