-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Showing
9 changed files
with
439 additions
and
2 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,35 @@ | ||
name: Check if package is installable | ||
inputs: | ||
opam: | ||
required: true | ||
package: | ||
reauired: true | ||
outputs: | ||
installable: | ||
description: "Is the package installable?" | ||
value: ${{ steps.installable.outputs.installable }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Get opam cli option | ||
id: cli | ||
shell: sh | ||
run: | | ||
if [ "${{ inputs.opam }}" = "opam-2.1" ]; then | ||
echo '##[set-output name=cli]--cli=2.1' | ||
fi | ||
- name: Check if package is installable | ||
id: installable | ||
shell: sh | ||
run: | | ||
if opam ${{ steps.cli.outputs.cli }} list --readonly --external --resolve=${{ inputs.package }} >/dev/null 2>&1; then | ||
echo '##[set-output name=installable]true'; | ||
else | ||
echo "Package is not installable"; | ||
fi | ||
- name: Annotate result | ||
if: ${{ !steps.installable.outputs.installable }} | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
core.notice('${{ inputs.package }} is not installable'); |
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,14 @@ | ||
name: Install OCaml | ||
inputs: | ||
compiler: | ||
reauired: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup OCaml | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ inputs.compiler }} | ||
opam-disable-sandboxing: true | ||
opam-repositories: | | ||
default: file://. |
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,30 @@ | ||
name: Install Package | ||
inputs: | ||
opam: | ||
required: true | ||
package: | ||
reauired: true | ||
env: | ||
default: '{}' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Get opam cli option | ||
id: cli | ||
shell: sh | ||
run: | | ||
if [ "${{ inputs.opam }}" = "opam-2.1" ]; then | ||
echo '##[set-output name=cli]--cli=2.1 --confirm-level=unsafe-yes' | ||
fi | ||
- name: Install ${{ inputs.package }} depopts | ||
if: inputs.opam == 'opam-2.0' | ||
shell: sh | ||
run: | | ||
opam depext ${{ inputs.package }} | ||
- name: Install ${{ inputs.package }} | ||
shell: sh | ||
env: ${{ fromJson(inputs.env) }} | ||
run: | | ||
opam install --deps-only ${{ steps.cli.outputs.cli }} ${{ inputs.package }} | ||
opam install ${{ steps.cli.outputs.cli }} ${{ inputs.package }} | ||
opam remove ${{ steps.cli.outputs.cli }} ${{ inputs.package }} |
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,35 @@ | ||
name: Install System Packages | ||
inputs: | ||
distribution: | ||
reauired: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install debian system packages | ||
if: startsWith(inputs.distribution, 'debian') || startsWith(inputs.distribution, 'ubuntu') | ||
shell: sh | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
apt-get update | ||
apt-get install -qq -yy curl darcs gcc git m4 make mercurial patch rsync sudo unzip bzip2 | ||
- name: Install alpine system packages | ||
if: startsWith(inputs.distribution, 'alpine') | ||
shell: sh | ||
run: | | ||
apk add build-base coreutils curl libgcc libstdc++ musl patch unzip bzip2 mercurial git rsync tar | ||
- name: Install yum-based system packages | ||
if: startsWith(inputs.distribution, 'centos') || startsWith(inputs.distribution, 'fedora') || startsWith(inputs.distribution, 'oraclelinux') | ||
shell: sh | ||
run: | | ||
yum install -y curl diffutils gcc gcc-c++ tar git m4 make mercurial patch rsync sudo unzip gzip bzip2 | ||
- name: Install opensuse system packages | ||
if: startsWith(inputs.distribution, 'opensuse') | ||
shell: sh | ||
run: | | ||
zypper install -y curl diffutils gcc gcc-c++ tar git m4 make mercurial patch rsync sudo unzip gzip bzip2 which | ||
- name: Install archlinux system packages | ||
if: startsWith(inputs.distribution, 'archlinux') | ||
shell: sh | ||
run: | | ||
pacman -Sy --noconfirm base-devel unzip git rsync |
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,26 @@ | ||
name: Get package revdeps | ||
inputs: | ||
package: | ||
reauired: true | ||
cache_key: | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Store package revdeps | ||
uses: actions/cache@v2 | ||
id: cache_revdeps | ||
with: | ||
path: ${{ inputs.package }}.revdeps | ||
key: ${{ inputs.cache_key }}-${{ inputs.package }} | ||
|
||
- name: Get package revdeps | ||
id: revdeps | ||
shell: sh | ||
if: ${{ !steps.cache_revdeps.outputs.cache-hit }} | ||
env: | ||
OCAMLCLI: '' | ||
run: | | ||
REVDEPS=`(opam list -s --color=never --depends-on ${{ inputs.package }} --coinstallable-with ${{ inputs.package }} --installable --all-versions --recursive --depopts && opam list -s --color=never --depends-on ${{ inputs.package }} --coinstallable-with ${{ inputs.package }} --installable --all-versions --with-test --depopts) | sort -u | grep -v ${{ inputs.package }} | while read i; do echo "\"$i\""; done | paste -sd ',' -` | ||
echo "${{ inputs.package }} revdeps: [$REVDEPS]" | ||
echo "[$REVDEPS]" > ${{ inputs.package }}.revdeps |
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,38 @@ | ||
name: Get revdeps configl | ||
inputs: | ||
packages: | ||
reauired: true | ||
cache_key: | ||
required: true | ||
outputs: | ||
revdeps_config: | ||
description: "Revdeps config" | ||
value: ${{ steps.revdeps_config.outputs.result }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14 | ||
- name: Install @action/cache | ||
shell: sh | ||
run: npm install @actions/cache | ||
- name: Collect revdeps | ||
id: revdeps_config | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const cache = require('@actions/cache'); | ||
const fs = require('fs'); | ||
let config = []; | ||
const packages = JSON.parse('${{ inputs.packages }}'); | ||
await Promise.all(packages.map(async (package) => { | ||
await cache.restoreCache([`${package}.revdeps`], `${{ inputs.cache_key }}-${package}`); | ||
const revdeps = JSON.parse(fs.readFileSync(`${package}.revdeps`)); | ||
revdeps.forEach((revdep) => config.push({package, revdep})); | ||
})); | ||
console.log(`Revdeps config: ${JSON.stringify(config, null, 2)}`); | ||
return config; |
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,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
PACKAGES=`git diff --name-only origin/master..HEAD | grep '^packages' | cut -d'/' -f 3 | while read i; do echo "\"$i\""; done` | ||
echo "Packages to test: [$PACKAGES]" | ||
echo "##[set-output name=packages][${PACKAGES}]" | ||
Oops, something went wrong.