Skip to content

Merge pull request #169 from indoorvivants/update/weaver-cats-0.8.4 #381

Merge pull request #169 from indoorvivants/update/weaver-cats-0.8.4

Merge pull request #169 from indoorvivants/update/weaver-cats-0.8.4 #381

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["*"]
env:
JAVA_OPTS: "-Xmx4G"
JVM_OPTS: "-Xmx4G"
SBT_OPTS: "-Xmx4G"
REGISTRY_IMAGE: keynmol/sn-vcpkg
jobs:
build:
name: Unix CI ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: sbt
- name: Tests
run: sbt test pluginTests checkDocs publishLocal versionDump
- name: Cold start tests (docker)
run: docker build . -t sbt-vcpkg-tests
if: startsWith(matrix.os, 'ubuntu-')
- name: Cache vcpkg
uses: actions/cache@v3
with:
path: |
~/Library/Caches/sbt-vcpkg/vcpkg-install
~/.cache/sbt-vcpkg/vcpkg-install
~/.cache/sbt-vcpkg/vcpkg
key: ${{ runner.os }}-sbt-vcpkg
- name: Run example
env:
LLVM_BIN: /usr/local/opt/llvm@14/bin
if: startsWith(matrix.os, 'macos-')
run: |
set -e
brew install llvm@14
cd example
SBT_VCPKG_VERSION=$(cat ../version) sbt example/run
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@main
- name: CLI tests
shell: bash
run: |
set -xe
curl -fLo cs https://github.com/coursier/launchers/raw/master/coursier && chmod +x cs
./cs bootstrap com.indoorvivants.vcpkg:sn-vcpkg_3:$(cat version) -f -o local_cli
./local_cli bootstrap
./local_cli install -v -c -l libpq s2n
echo '{"name": "my-application","version": "0.15.2","dependencies": ["sqlite3"]}' > test-vcpkg.json
./local_cli install -v -c -l --manifest test-vcpkg.json
./local_cli clang -v sqlite3 -- .github/workflows/fixtures/test-sqlite.c
./local_cli clang -v --manifest test-vcpkg.json -- .github/workflows/fixtures/test-sqlite.c
./local_cli clang++ -v sqlite3 -- .github/workflows/fixtures/test-sqlite.c
./local_cli clang++ -v --manifest test-vcpkg.json -- .github/workflows/fixtures/test-sqlite.c
./local_cli clang -v curl --rename curl=libcurl -- .github/workflows/fixtures/test-curl.c && ./a.out
./local_cli scala-cli -v sqlite3 -- run .github/workflows/fixtures/test-scala-cli.scala
windows_build:
name: Windows CI
strategy:
fail-fast: false
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Setup git config
run: git config --global core.autocrlf false
- name: Install pkg-config on Windows
run: choco install pkgconfiglite
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: sbt
- name: Test
run: sbt test
mergify-build-checkpoint:
runs-on: ubuntu-latest
needs: [build, windows_build]
steps:
- name: I only exist to please Mergify :(
run: echo "It's a sad existence but necessary"
release:
name: Release
needs: [build, windows_build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: sbt
- name: Publish ${{ github.ref }}
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
id: build
uses: docker/build-push-action@v4
with:
push: false
file: ./modules/sn-vcpkg-docker/Dockerfile
context: .
outputs: type=image,name=${{ env.REGISTRY_IMAGE }}
docker_release_build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build and push by digest
id: build
uses: docker/build-push-action@v4
with:
context: .
file: ./modules/sn-vcpkg-docker/Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE}}:main
cache-to: type=inline
-
name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
docker_release_merge:
runs-on: ubuntu-latest
needs: [docker_release_build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
steps:
-
name: Download digests
uses: actions/download-artifact@v3
with:
name: digests
path: /tmp/digests
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}