-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6cb46bc
Showing
33 changed files
with
6,103 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=$BUILDPLATFORM alpine AS build | ||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
ADD dist /dist | ||
RUN if [[ "${TARGETPLATFORM}" == "linux/amd64" ]]; then \ | ||
cp /dist/x86_64-unknown-linux-musl/contemplate-x86_64-unknown-linux-musl /contemplate; \ | ||
elif [[ "${TARGETPLATFORM}" == "linux/arm64" ]]; then \ | ||
cp /dist/aarch64-unknown-linux-musl/contemplate-aarch64-unknown-linux-musl /contemplate; \ | ||
elif [[ "${TARGETPLATFORM}" == "linux/386" ]]; then \ | ||
cp /dist/i686-unknown-linux-musl/contemplate-i686-unknown-linux-musl /contemplate; \ | ||
fi | ||
FROM scratch | ||
COPY --from=build --chmod=755 /contemplate /contemplate | ||
LABEL org.opencontainers.image.title="Contemplate" | ||
LABEL org.opencontainers.image.base.name="infrarun/contemplate" | ||
LABEL org.opencontainers.image.source="https://github.com/infrarun/contemplate" | ||
LABEL org.opencontainers.image.authors="infra.run" | ||
LABEL org.opencontainers.image.url="https://infrarun.github.io/contemplate/" | ||
LABEL org.opencontainers.image.documentation="https://infrarun.github.io/contemplate/" | ||
LABEL org.opencontainers.image.vendor="infra.run" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
ENTRYPOINT [ "/contemplate" ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
on: [push, pull_request] | ||
|
||
name: CI | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
continue-on-error: false | ||
with: | ||
command: test | ||
|
||
lints: | ||
name: Lints | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
continue-on-error: false | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
continue-on-error: false | ||
with: | ||
command: clippy | ||
args: -- -D warnings |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Docs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- run: pip install mkdocs-material | ||
- run: mkdocs gh-deploy --force |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
get-next-version: | ||
uses: semantic-release-action/next-release-version/.github/workflows/next-release-version.yml@v4 | ||
|
||
build: | ||
name: build | ||
if: needs.get-next-version.outputs.new-release-published == 'true' | ||
runs-on: ${{ matrix.build.os }} | ||
needs: | ||
- get-next-version | ||
env: | ||
CARGO: cargo | ||
strategy: | ||
matrix: | ||
build: | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
cross: true | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-musl | ||
cross: true | ||
- os: ubuntu-latest | ||
target: i686-unknown-linux-gnu | ||
cross: true | ||
- os: ubuntu-latest | ||
target: i686-unknown-linux-musl | ||
cross: true | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
cross: false | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
cross: false | ||
- os: macOS-latest | ||
target: x86_64-apple-darwin | ||
cross: false | ||
- os: macOS-latest | ||
target: aarch64-apple-darwin | ||
cross: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install build inputs | ||
if: runner.os == 'Linux' && !matrix.build.cross | ||
run: sudo apt install musl-tools | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
target: ${{ matrix.build.target }} | ||
|
||
- name: Cache cargo | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
.cargo-cache | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Install semantic-release-cargo | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: semantic-release-cargo@2 | ||
|
||
- name: Prepare semantic-release for Rust | ||
run: semantic-release-cargo prepare ${{ needs.get-next-version.outputs.new-release-version }} | ||
|
||
- name: Install cross | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cross | ||
|
||
- name: Configure cross | ||
if: matrix.build.cross | ||
run: echo "CARGO=cross" >> "$GITHUB_ENV" | ||
|
||
- name: Compile release binary | ||
run: ${{ env.CARGO }} build --bin contemplate --release --target ${{ matrix.build.target }} --verbose | ||
|
||
- name: Create release archive | ||
run: | | ||
mkdir dist | ||
cp target/${{ matrix.build.target }}/release/contemplate dist/contemplate-${{ matrix.build.target }} | ||
- name: Create binary checksum | ||
run: shasum --algorithm 256 --binary contemplate-${{ matrix.build.target }} | tee contemplate-${{ matrix.build.target }}-SHA256SUM.txt | ||
working-directory: ./dist | ||
|
||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.build.target }} | ||
path: | | ||
dist/contemplate-${{ matrix.build.target }} | ||
dist/contemplate-${{ matrix.build.target }}-SHA256SUM.txt | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get-next-version | ||
- build | ||
if: needs.get-next-version.outputs.new-release-published == 'true' | ||
permissions: | ||
contents: write # to be able to publish a GitHub release | ||
issues: write # to be able to comment on released issues | ||
pull-requests: write # to be able to comment on released pull requests | ||
packages: write # to be able to publish a package | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Set up Docker to use the containerd snapshotter' | ||
run: | | ||
cat /etc/docker/daemon.json | jq '. | .+{"features": {"containerd-snapshotter": true}}' | sudo tee /etc/docker/daemon.json | ||
sudo systemctl restart docker | ||
docker info -f '{{ .DriverStatus }}' | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Cache cargo | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
.cargo-cache | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Download release artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts | ||
|
||
- name: Prepare GitHub Release artifacts | ||
run: | | ||
mkdir dist/ | ||
mv artifacts/aarch64-apple-darwin dist/ | ||
mv artifacts/aarch64-unknown-linux-gnu dist/ | ||
mv artifacts/aarch64-unknown-linux-musl dist/ | ||
mv artifacts/i686-unknown-linux-gnu dist/ | ||
mv artifacts/i686-unknown-linux-musl dist/ | ||
mv artifacts/x86_64-apple-darwin dist/ | ||
mv artifacts/x86_64-unknown-linux-gnu dist/ | ||
mv artifacts/x86_64-unknown-linux-musl dist/ | ||
- name: Combine checksums | ||
run: cat dist/**/contemplate-*-SHA256SUM.txt | tee dist/SHA256SUMS.txt | ||
|
||
- name: Build docker container | ||
run: docker buildx build --platform linux/amd64,linux/arm64,linux/i386 --load -t infrarun/contemplate -f .ci/docker/Dockerfile . | ||
|
||
- name: Semantic Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: > | ||
npx --yes | ||
--package @semantic-release-cargo/semantic-release-cargo | ||
--package @semantic-release/changelog | ||
--package @semantic-release/git | ||
--package @semantic-release-plus/docker | ||
--package semantic-release | ||
-- semantic-release |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
target/ | ||
dist/ | ||
|
||
.DS_Store | ||
desktop.ini | ||
|
||
*.swp | ||
*.swo | ||
Session.vim | ||
.cproject | ||
.idea | ||
*.iml | ||
.vscode | ||
.project | ||
.favorites.json | ||
.settings/ | ||
.vs/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
branches: ['main'] | ||
plugins: | ||
- "@semantic-release-cargo/semantic-release-cargo" | ||
- "@semantic-release/release-notes-generator" | ||
- "@semantic-release/changelog" | ||
- | ||
- "@semantic-release/github" | ||
- assets: | ||
- path: "dist/x86_64-unknown-linux-musl/contemplate-x86_64-unknown-linux-musl" | ||
label: "x86_64-unknown-linux-musl" | ||
- path: "dist/x86_64-unknown-linux-gnu/contemplate-x86_64-unknown-linux-gnu" | ||
label: "x86_64-unknown-linux-gnu" | ||
- path: "dist/i686-unknown-linux-musl/contemplate-i686-unknown-linux-musl" | ||
label: "i686-unknown-linux-musl" | ||
- path: "dist/i686-unknown-linux-gnu/contemplate-i686-unknown-linux-gnu" | ||
label: "i686-unknown-linux-gnu" | ||
- path: "dist/x86_64-apple-darwin/contemplate-x86_64-apple-darwin" | ||
label: "x86_64-apple-darwin" | ||
- path: "dist/aarch64-unknown-linux-musl/contemplate-aarch64-unknown-linux-musl" | ||
label: "aarch64-unknown-linux-musl" | ||
- path: "dist/aarch64-unknown-linux-gnu/contemplate-aarch64-unknown-linux-gnu" | ||
label: "aarch64-unknown-linux-gnu" | ||
- path: "dist/aarch64-apple-darwin/contemplate-aarch64-apple-darwin" | ||
label: "aarch64-apple-darwin" | ||
- path: "dist/SHA256SUMS.txt" | ||
label: "SHA256SUMS.txt" | ||
- | ||
- "@semantic-release/git" | ||
- assets: | ||
- "Cargo.toml" | ||
- "Cargo.lock" | ||
- "CHANGELOG.md" | ||
- | ||
- "@semantic-release-plus/docker" | ||
- name: infrarun/contemplate | ||
registry: ghcr.io | ||
skipLogin: true |
Empty file.
Oops, something went wrong.