Lock scratchstack-aws-signature version (#52) #72
This file contains 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: Makefile CI | |
env: | |
RUST_BACKTRACE: 1 | |
PROJECT_DIR: xks-axum | |
on: | |
pull_request: | |
push: | |
branches: [ "main" ] | |
jobs: | |
style: | |
name: Check Style | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Check format | |
run: cargo fmt --manifest-path=${{ env.PROJECT_DIR }}/Cargo.toml --all -- --check | |
test-n-clippy: | |
name: Unit Test and Clippy | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, al2, al2aarch64] | |
runs-on: ${{ matrix.os }} | |
needs: style | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Unit Test | |
run: cargo test --manifest-path=${{ env.PROJECT_DIR }}/Cargo.toml | |
- name: Clippy | |
run: cargo clippy --manifest-path=${{ env.PROJECT_DIR }}/Cargo.toml | |
miri: | |
name: Check for Undefined Behavior | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, al2, al2aarch64] | |
runs-on: ${{ matrix.os }} | |
needs: style | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust Nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: miri | |
- name: Miri Test | |
env: | |
MIRIFLAGS: -Zmiri-disable-isolation | |
run: cargo +nightly miri test --manifest-path=${{ env.PROJECT_DIR }}/Cargo.toml | |
check-on-macos: | |
name: Check on Mac | |
runs-on: macos-12 | |
needs: style | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Check | |
run: cargo check --manifest-path=${{ env.PROJECT_DIR }}/Cargo.toml | |
# The pkcs11 crate v0.5.0 doesn't compile on Windows | |
# https://docs.rs/pkcs11/latest/pkcs11/ | |
# check-on-windows: | |
# runs-on: windows-latest | |
build: | |
name: Build Packages | |
strategy: | |
matrix: | |
config: | |
- { os: ubuntu-22.04, arch: x86_64 } | |
- { os: al2, arch: x86_64 } | |
- { os: al2aarch64, arch: aarch64 } | |
runs-on: ${{ matrix.config.os }} | |
needs: [test-n-clippy, miri, check-on-macos] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install other dependencies | |
run: | | |
if type apt-get 2>/dev/null; then | |
# Install on Debian/Ubuntu | |
sudo apt-get install -y rpm alien | |
fi | |
if type yum 2>/dev/null; then | |
# Install on Centos/AL2 | |
sudo yum install -y rpmdevtools rpm-build rpm-devel rpmlint | |
fi | |
- name: Build xks-proxy rpm and deb | |
run: | | |
make | |
rpm_name=$(basename ~/rpmbuild/RPMS/**/*.rpm) | |
echo "RPM_NAME=$rpm_name" >> $GITHUB_ENV | |
if ls *.deb >/dev/null 2>&1; then | |
deb_name=$(ls *.deb) | |
# Include the architecture as part of the file name | |
arch_deb_name=${deb_name/.deb/-${{ matrix.config.arch }}.deb} | |
mv "$deb_name" "$arch_deb_name" | |
echo "DEB_ARTIFACT=$arch_deb_name" >> $GITHUB_ENV | |
else | |
echo "DEB_ARTIFACT=None" >> $GITHUB_ENV | |
fi | |
- name: Upload rpm | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.RPM_NAME }} | |
path: ~/rpmbuild/RPMS/**/${{ env.RPM_NAME }} | |
- name: Upload deb | |
if: env.DEB_ARTIFACT != 'None' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.DEB_ARTIFACT }} | |
path: ./*.deb | |
build-docker: | |
name: Build Docker Image | |
strategy: | |
matrix: | |
# https://github.com/orgs/community/discussions/25949 | |
config: | |
- { os: al2, arch: x86_64 } | |
- { os: al2aarch64, arch: aarch64 } | |
runs-on: ${{ matrix.config.os }} | |
needs: [test-n-clippy, miri, check-on-macos] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Docker | |
run: | | |
if type yum 2>/dev/null; then | |
# Install on Centos/AL2 | |
sudo yum install -y docker | |
fi | |
# https://stackoverflow.com/questions/53918841/how-to-install-docker-on-amazon-linux2 | |
- name: Start Docker | |
run: | | |
if type yum 2>/dev/null; then | |
sudo service docker start | |
sudo usermod -a -G docker ec2-user | |
sudo chmod 666 /var/run/docker.sock | |
docker version | |
fi | |
- name: Build docker image | |
run: | | |
docker build -t xks-proxy:latest . | |
docker save -o xks-proxy-docker-v3.1.2-${{ matrix.config.arch }}.tar xks-proxy:latest | |
xz -z -0 xks-proxy-docker-v3.1.2-${{ matrix.config.arch }}.tar | |
- name: Upload docker image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xks-proxy-docker-v3.1.2-${{ matrix.config.arch }}.tar.xz | |
path: ./xks-proxy-docker-v3.1.2-${{ matrix.config.arch }}.tar.xz |