2021-12-19 23:12:25 +01:00
|
|
|
name: 'MinedMap'
|
2025-02-21 10:51:05 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
workflow_dispatch: {}
|
2021-12-19 23:12:25 +01:00
|
|
|
|
2023-09-17 15:50:07 +02:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: -Dwarnings
|
|
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
|
|
|
2021-12-19 23:12:25 +01:00
|
|
|
jobs:
|
2021-12-19 23:19:56 +01:00
|
|
|
viewer:
|
2025-02-14 17:28:47 +01:00
|
|
|
runs-on: 'ubuntu-latest'
|
2021-12-19 23:19:56 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: 'Checkout'
|
2023-09-17 13:18:48 +02:00
|
|
|
uses: 'actions/checkout@v4'
|
2021-12-19 23:19:56 +01:00
|
|
|
|
|
|
|
- name: 'Get version'
|
|
|
|
id: 'tag'
|
|
|
|
run: |
|
|
|
|
set -o pipefail
|
2022-10-16 12:24:48 +02:00
|
|
|
git fetch --prune --unshallow --tags -f
|
2022-10-16 12:49:13 +02:00
|
|
|
echo "tag=$(git describe --abbrev=7 --match='v*' | sed 's/^v//')" >> $GITHUB_OUTPUT
|
2021-12-19 23:19:56 +01:00
|
|
|
|
|
|
|
- name: 'Install'
|
|
|
|
run: |
|
|
|
|
pkgdir='build/pkg/MinedMap-${{ steps.tag.outputs.tag }}-viewer'
|
|
|
|
mkdir -p "$pkgdir"
|
|
|
|
cp -r viewer/* "$pkgdir"/
|
2025-02-14 17:18:14 +01:00
|
|
|
rm "$pkgdir"/Dockerfile
|
2021-12-19 23:19:56 +01:00
|
|
|
|
|
|
|
- name: 'Archive'
|
2025-02-11 23:04:08 +01:00
|
|
|
uses: 'actions/upload-artifact@v4'
|
2021-12-19 23:19:56 +01:00
|
|
|
with:
|
|
|
|
name: 'MinedMap-${{ steps.tag.outputs.tag }}-viewer'
|
|
|
|
path: 'build/pkg'
|
2023-09-17 15:50:07 +02:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: rustfmt
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: clippy
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- uses: actions-rs/clippy-check@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
args: --workspace --tests --examples
|
|
|
|
|
|
|
|
docs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: rust-docs
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- run: cargo doc --workspace --no-deps --document-private-items
|
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
|
|
rust: [stable]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
- run: cargo test --workspace
|
|
|
|
- run: cargo test --workspace --no-default-features
|
|
|
|
- run: cargo test --workspace --examples --bins
|
|
|
|
- run: cargo test --workspace --no-default-features --examples --bins
|
2023-09-17 18:52:18 +02:00
|
|
|
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2024-06-19 19:38:52 +02:00
|
|
|
- os: 'macos-13'
|
2023-09-17 18:52:18 +02:00
|
|
|
target: 'aarch64-apple-darwin'
|
2024-06-19 19:38:52 +02:00
|
|
|
- os: 'macos-13'
|
2023-09-17 18:52:18 +02:00
|
|
|
target: 'x86_64-apple-darwin'
|
|
|
|
- os: 'windows-2019'
|
|
|
|
target: 'x86_64-pc-windows-msvc'
|
|
|
|
ext: '.exe'
|
|
|
|
- os: 'windows-2019'
|
|
|
|
target: 'i686-pc-windows-msvc'
|
|
|
|
ext: '.exe'
|
2025-02-14 17:28:47 +01:00
|
|
|
- os: 'ubuntu-22.04'
|
2023-09-17 18:52:18 +02:00
|
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: 'Checkout'
|
|
|
|
uses: 'actions/checkout@v4'
|
|
|
|
|
|
|
|
- name: 'Get version'
|
|
|
|
id: 'tag'
|
|
|
|
shell: 'bash'
|
|
|
|
run: |
|
|
|
|
set -o pipefail
|
|
|
|
git fetch --prune --unshallow --tags -f
|
|
|
|
echo "tag=$(git describe --abbrev=7 --match='v*' | sed 's/^v//')" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: '${{ matrix.target }}'
|
|
|
|
|
|
|
|
- uses: swatinem/rust-cache@v2
|
|
|
|
|
|
|
|
- name: 'Build'
|
|
|
|
shell: 'bash'
|
2023-09-17 22:27:24 +02:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: -Dwarnings -Cstrip=symbols
|
2023-09-17 18:52:18 +02:00
|
|
|
run: |
|
2023-09-17 21:45:36 +02:00
|
|
|
pkgdir='target/pkg/MinedMap-${{ steps.tag.outputs.tag }}-${{ matrix.target }}'
|
2023-09-17 18:52:18 +02:00
|
|
|
mkdir -p "$pkgdir"
|
|
|
|
cargo build --release --target=${{ matrix.target }}
|
|
|
|
cp target/${{ matrix.target }}/release/minedmap${{ matrix.ext }} "$pkgdir"/
|
|
|
|
|
|
|
|
- name: 'Archive'
|
2025-02-11 23:04:08 +01:00
|
|
|
uses: 'actions/upload-artifact@v4'
|
2023-09-17 18:52:18 +02:00
|
|
|
with:
|
2023-09-17 21:45:36 +02:00
|
|
|
name: 'MinedMap-${{ steps.tag.outputs.tag }}-${{ matrix.target }}'
|
2023-09-17 18:52:18 +02:00
|
|
|
path: 'target/pkg'
|
2025-02-21 10:51:05 +01:00
|
|
|
|
|
|
|
build-container:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
steps:
|
2025-02-22 11:06:46 +01:00
|
|
|
- name: 'Checkout'
|
|
|
|
uses: 'actions/checkout@v4'
|
|
|
|
|
|
|
|
- name: 'Get version'
|
|
|
|
id: 'tag'
|
|
|
|
run: |
|
|
|
|
set -o pipefail
|
|
|
|
git fetch --prune --unshallow --tags -f
|
|
|
|
echo "tag=$(git describe --abbrev=7 --match='v*' | sed 's/^v//')" >> $GITHUB_OUTPUT
|
|
|
|
|
2025-02-21 10:51:05 +01:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
ghcr.io/neocturne/minedmap/minedmap
|
|
|
|
tags: |
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=branch,suffix=-{{sha}}
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
- name: Login to GHCR
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
2025-02-22 11:06:46 +01:00
|
|
|
build-args: |
|
|
|
|
MINEDMAP_VERSION=${{ steps.tag.outputs.tag }}
|
2025-02-21 10:51:05 +01:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|
|
viewer-container:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
steps:
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
ghcr.io/neocturne/minedmap/viewer
|
|
|
|
tags: |
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=branch,suffix=-{{sha}}
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
- name: Login to GHCR
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
context: "{{defaultContext}}:viewer"
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|