Skip to content

CI: Update Dockerfile to install OpenSSL 3 #259

CI: Update Dockerfile to install OpenSSL 3

CI: Update Dockerfile to install OpenSSL 3 #259

Workflow file for this run

name: CI/CD
on:
push:
branches: '*'
tags-ignore:
- dhall-package-*
pull_request: {}
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- stable
- beta
- nightly
features:
- []
- [native-tls, dhall]
- [rustls]
include:
- toolchain: stable
components: clippy
- os: ubuntu-latest
toolchain: stable
features: []
components: clippy,rustfmt
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEBUG_DEBUG: 0
RUSTFLAGS: --deny warnings
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v2
- name: Install `libsqlite3-dev`
if: runner.os == 'Linux'
run: sudo apt-get install libsqlite3-dev
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
components: ${{ matrix.components }}
- name: Check format
if: contains(matrix.components, 'rustfmt')
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- uses: Swatinem/rust-cache@v1
- name: Clippy library
if: contains(matrix.components, 'clippy')
uses: actions-rs/cargo@v1
with:
command: clippy
args: --lib --no-default-features --features=winsqlite3,${{ join(matrix.features) }} -- --deny rust-2018-idioms --deny warnings
- name: Clippy all
# XXX: GitHub Actions seem to have no ability to handle array literals in expressions
# like `matrix.features != []`.
if: contains(matrix.components, 'clippy') && join(matrix.features) != ''
uses: actions-rs/cargo@v1
with:
command: clippy
args: --no-default-features --features=winsqlite3,${{ join(matrix.features) }} -- --deny rust-2018-idioms --deny warnings
- name: Build library
uses: actions-rs/cargo@v1
with:
command: build
args: --lib --verbose --no-default-features --features=winsqlite3,${{ join(matrix.features) }}
- name: Build all
if: join(matrix.features) != ''
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --no-default-features --features=winsqlite3,${{ join(matrix.features) }}
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --no-default-features --features=winsqlite3,${{ join(matrix.features) }}
build:
name: Build release artifacts
# XXX: Yes, I doubt if this is the best way of doing it...
# Ideally, we want it to match SemVer tag names.
if: |
github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/v0.')
|| startsWith(github.event.ref, 'refs/tags/v1')
|| startsWith(github.event.ref, 'refs/tags/v2')
|| startsWith(github.event.ref, 'refs/tags/v3')
|| startsWith(github.event.ref, 'refs/tags/v4')
|| startsWith(github.event.ref, 'refs/tags/v5')
|| startsWith(github.event.ref, 'refs/tags/v6')
|| startsWith(github.event.ref, 'refs/tags/v7')
|| startsWith(github.event.ref, 'refs/tags/v8')
|| startsWith(github.event.ref, 'refs/tags/v9')
|| github.event.ref == 'refs/heads/release-test'
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-unknown-linux-gnu
- aarch64-apple-darwin
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
# - x86_64-unknown-freebsd
include:
- os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
use_cross: true
- target: armv7-unknown-linux-gnueabihf
use_cross: true
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
features: [winsqlite3]
# - target: x86_64-unknown-freebsd
# use_cross: true
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
CARGO_PROFILE_RELEASE_LTO: fat
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v2
- name: Install packages (x86_64-unknown-linux-gnu)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: sudo apt-get install libsqlite3-dev libssl-dev
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: vcpkg install sqlite3:x64-windows
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
- uses: Swatinem/rust-cache@v1
if: github.event.ref == 'refs/heads/release-test'
- name: Install `cross`
if: matrix.use_cross && join(matrix.features) != ''
uses: actions-rs/install@v0.1
with:
crate: cross
use-tool-cache: true
# Workaround for <https://github.com/rust-embedded/cross/issues/466>.
- name: Install `cross`
if: matrix.use_cross && join(matrix.features) == ''
run: |
REV=8ea5d4600fe65dd0797509cfc2e1786638a0327f
curl -fLOsS "https://github.com/rust-embedded/cross/archive/$REV.zip"
unzip "$REV.zip"
cargo install --path="cross-$REV"
env:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 16
CARGO_PROFILE_RELEASE_LTO: thin
- name: Set opt-level
if: github.event.ref == 'refs/heads/release-test'
run: |
cat <<ENV >> "$GITHUB_ENV"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16
CARGO_PROFILE_RELEASE_LTO=false
CARGO_PROFILE_RELEASE_OPT_LEVEL=0
ENV
shell: bash
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --bin pipitor --release '--features=${{ join(matrix.features) }}' '--target=${{ matrix.target }}'
use-cross: ${{ matrix.use_cross }}
env:
# Work around <https://github.com/actions/virtual-environments/issues/2557>.
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
- name: Archive the binary
id: archive
run: |
set -o errexit
tag="${GITHUB_REF##*/}"
name="pipitor-$tag-${{ matrix.target }}"
if [ '${{ runner.os }}' = Windows ]; then
asset_name="$name.zip"
ln 'target/${{ matrix.target }}/release/pipitor.exe' .
7z a "$asset_name" pipitor.exe
else
asset_name="$name.tar.gz"
ln 'target/${{ matrix.target }}/release/pipitor' .
tar -czf "$asset_name" pipitor
fi
echo "::set-output name=asset::$asset_name"
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: ${{ steps.archive.outputs.asset }}
release:
name: Create GitHub release
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Sign release assets
working-directory: artifact
run: |
set -o errexit -o xtrace
gpg --batch --import <<< "$PRIVATE_KEY"
for f in *; do
gpg --batch --local-user C90F234F43B5075A0D96C6D5986E104E7F079F61 --armor --detach-sign "$f"
done
gpg --batch --yes --delete-secret-keys C90F234F43B5075A0D96C6D5986E104E7F079F61
shell: bash
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
- name: Get the tag info
id: tag
run: |
set -o errexit
if [[ "$GITHUB_REF" == 'refs/tags/'* ]]; then
tag="${GITHUB_REF#refs/tags/}"
git tag -d "$tag"
git fetch --no-tags origin "$tag:$GITHUB_REF"
echo "::set-output name=subject::$(git tag --list --format='%(contents:subject)' "$tag")"
git tag -l --format='%(contents:body)' "$tag" |
sed -n '/^-----BEGIN PGP SIGNATURE-----$/q; p' \
> body.txt
else
echo "::set-output name=subject::Test release"
touch body.txt
fi
shell: bash
- name: Create release
uses: tesaguri/action-gh-release@draft-wo-tag
with:
body_path: body.txt
name: ${{ steps.tag.outputs.subject }}
draft: ${{ github.event.ref == 'refs/heads/release-test' }}
files: artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}