Skip to content

Commit

Permalink
Merge pull request #562 from coq-community/release-opam-publish
Browse files Browse the repository at this point in the history
Automated submission of OPAM package on release
  • Loading branch information
maximedenes authored Aug 17, 2023
2 parents 64af6a3 + c0a7d06 commit 2b4a1be
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 85 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,32 @@ jobs:
yarn deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}

publish-opam-package:
strategy:
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.14.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Install opam-publish # 2.0.3 because more recent versions do not respect OPAMYES
run: opam install -y -j 2 opam-publish=2.0.3

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Publish
run: |
eval $(opam env)
VERSION_SLUG="${GITHUB_REF_SLUG#v}"
VERSION="${GITHUB_REF#v}"
cd language-server
opam publish --no-browser --repo=coq/opam-coq-archive --packages-directory=extra-dev/packages -v $VERSION https://github.com/coq-community/vscoq/releases/download/$GITHUB_REF/vscoq-language-server-$VERSION_SLUG.tar.gz vscoq-language-server.opam
82 changes: 7 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
pull_request:
workflow_dispatch:

env:
PIN_COQ: 51814505fdeb5bc9f11fc7bd95493f0e7397509f

jobs:
build-extension:
strategy:
Expand Down Expand Up @@ -57,7 +54,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.14.x]
ocaml-compiler: [4.13.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -68,17 +65,11 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Pin Coq
env:
OPAMYES: true
run: |
opam pin add coq-core.dev "https://github.com/coq/coq.git#$PIN_COQ"
opam pin add coq-stdlib.dev "https://github.com/coq/coq.git#$PIN_COQ"
- name: Install vscoq-language-server
env:
OPAMYES: true
run: |
opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev
opam pin add vscoq-language-server ./language-server/ --with-doc --with-test -y
- run: |
Expand Down Expand Up @@ -111,6 +102,8 @@ jobs:

- name: Build language server
run: .\language-server\build-windows-platform.bat
env:
COQ_VERSION: V8.18+rc1

- run: C:\ci\cygwin64\bin\bash.exe --login -c 'echo vscoqtop=$(cygpath -m $(which vscoqtop))' >> $Env:GITHUB_ENV

Expand All @@ -127,7 +120,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.14.x]
ocaml-compiler: [4.13.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -138,17 +131,11 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Pin Coq
env:
OPAMYES: true
run: |
opam pin add coq-core.dev "https://github.com/coq/coq.git#$PIN_COQ"
opam pin add coq-stdlib.dev "https://github.com/coq/coq.git#$PIN_COQ"
- name: Install deps
env:
OPAMYES: true
run: |
opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev
opam install ./language-server/vscoq-language-server.opam --deps-only --with-doc --with-test
- name: Build vscoq-language-server
Expand All @@ -171,61 +158,6 @@ jobs:
run: cat /tmp/vscoq_init_log.*


release-opam:
strategy:
matrix:
os: [ubuntu-latest]
ocaml-compiler: [4.14.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Build release
run: |
eval $(opam env)
cd language-server
./make-release.sh
- name: Add released repo
run: |
eval $(opam env)
opam repo add release file://$PWD/language-server/_build/opam-repository
- name: Pin Coq
env:
OPAMYES: true
run: |
opam pin add coq-core.dev "https://github.com/coq/coq.git#$PIN_COQ"
opam pin add coq-stdlib.dev "https://github.com/coq/coq.git#$PIN_COQ"
- name: Install
run: |
eval $(opam env)
opam install vscoq-language-server
- run: |
eval $(opam env)
echo "vscoqtop=`which vscoqtop`" >> $GITHUB_ENV
vscoqtop -v
- uses: actions/setup-node@v3
with:
node-version: 16

- run: cd client && yarn run package
- run: eval $(opam env) && cd client && xvfb-run yarn test
env:
VSCOQPATH: ${{ env.vscoqtop }}
VSCOQARGS: "-bt"
- if: ${{ failure() }}
run: cat /tmp/vscoq_init_log.*

create-release:
runs-on: ubuntu-latest
needs: [build-extension, nix-dev-build, install-opam, install-windows, dev-setup-opam]
Expand All @@ -250,4 +182,4 @@ jobs:
fail_on_unmatched_files: true
draft: true
prerelease: true
generate_release_notes: true
generate_release_notes: true
8 changes: 4 additions & 4 deletions language-server/build-windows-platform.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ call coq_platform_make_windows.bat ^
-jobs=2 ^
-switch=d ^
-set-switch=y ^
-override-dev-pkg="coq-core=https://github.com/coq/coq/archive/%PIN_COQ%.tar.gz" ^
-override-dev-pkg="coq-stdlib=https://github.com/coq/coq/archive/%PIN_COQ%.tar.gz" ^
-override-dev-pkg="coq=https://github.com/coq/coq/archive/%PIN_COQ%.tar.gz" ^
-override-dev-pkg="coq-core=https://github.com/coq/coq/archive/%COQ_VERSION%.tar.gz" ^
-override-dev-pkg="coq-stdlib=https://github.com/coq/coq/archive/%COQ_VERSION%.tar.gz" ^
-override-dev-pkg="coq=https://github.com/coq/coq/archive/%COQ_VERSION%.tar.gz" ^
|| GOTO ErrorExit

SET OPAMYES=yes
C:\ci\cygwin64\bin\bash.exe --login -c "opam pin add vscoq-language-server $(cygpath -m '%GITHUB_WORKSPACE%\language-server') --with-doc --with-test -y" || GOTO ErrorExit
C:\ci\cygwin64\bin\bash.exe --login -c "opam pin add --ignore-constraints-on=coq-core,coq-stdlib vscoq-language-server $(cygpath -m '%GITHUB_WORKSPACE%\language-server') --with-doc --with-test -y" || GOTO ErrorExit


GOTO :EOF
Expand Down
12 changes: 6 additions & 6 deletions language-server/vscoq-language-server.opam
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
opam-version: "2.0"
name: "vscoq-language-server"
maintainer: "Enrico Tassi <enrico.tassi@inria.fr>"
authors: [ "Enrico Tassi" "Maxime Denes" ]
license: "LGPL-2.1-or-later"
authors: [ "Enrico Tassi" "Maxime Dénès" "Romain Tetley" ]
license: "MIT"
homepage: "https://github.com/coq-community/vscoq"
bug-reports: "https://github.com/coq-community/vscoq/issues"
dev-repo: "git+https://github.com/coq-community/vscoq"

build: [
[ "sed" "-e" "/vendored_dirs coq/d" "-ibak" "dune" ]
[ "dune" "build" "-p" "vscoq-language-server" "--display=short"]
[ "dune" "build" "-p" name "-j" jobs ]
]
depends: [
"coq-core" {= "dev"}
"coq-stdlib" {= "dev"}
"ocaml" { >= "4.13.1" }
"coq-core" { >= "8.18" < "8.19" }
"coq-stdlib" { >= "8.18" < "8.19" }
"yojson"
"ocamlfind"
"ppx_inline_test"
Expand Down

0 comments on commit 2b4a1be

Please sign in to comment.