Skip to content

Commit b2da4f1

Browse files
committed
ci: simplify test workflow
Now we have the `latest-version` and `verify-version` actions that encapsulates the code that is needed to perform the version checks. Let's use them to reduce code duplication and simplify reading. Fixes #46
1 parent ab69f56 commit b2da4f1

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

.github/workflows/test.yml

+13-31
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,22 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838

39-
- id: get-latest
40-
run: |
41-
node <<'SCRIPT'
42-
process.env["INPUT_TARANTOOL-VERSION"] = "${{ matrix.tarantool }}"
43-
process.env["INPUT_NIGHTLY-BUILD"] = "${{ matrix.nightly }}"
44-
require("./dist/main").latest_version().then(v => {
45-
console.log(v)
46-
require("./dist/main").setActionOutput('version', v);
47-
})
48-
SCRIPT
39+
- id: latest-version
40+
uses: ./.github/actions/latest-version
41+
with:
42+
tarantool-series: ${{ matrix.tarantool }}
43+
nightly-build: ${{ matrix.nightly }}
4944

5045
- name: Setup from scratch
5146
uses: ./
5247
with:
5348
tarantool-version: ${{ matrix.tarantool }}
5449
nightly-build: ${{ matrix.nightly }}
5550

56-
- name: Check precise version
57-
run: |
58-
dpkg -s tarantool | grep '^Version: ${{ steps.get-latest.outputs.version }}'
59-
# It'll also fail if tarantool is installed from cache but not from apt-get
51+
- uses: ./.github/actions/verify-version
52+
with:
53+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
54+
from-cache: false
6055

6156
- name: Uninstall tarantool
6257
run: sudo apt-get -y remove tarantool tarantool-dev tarantool-common
@@ -67,23 +62,10 @@ jobs:
6762
tarantool-version: ${{ matrix.tarantool }}
6863
nightly-build: ${{ matrix.nightly }}
6964

70-
- name: Verify install from cache
71-
run: |
72-
# Fail if tarantool is installed from apt-get
73-
if dpkg -s tarantool; then
74-
echo "Tarantool wasn't restored from cache"
75-
exit 1
76-
fi
77-
78-
- name: Check branch version
79-
run: |
80-
T=$(tarantool -e 'print(_TARANTOOL:match("%d+%.%d+")); os.exit()')
81-
if [ "$T" != "${{ matrix.tarantool }}" ]; then
82-
echo "Tarantool version is $T, expected ${{ matrix.tarantool }}"
83-
exit 1
84-
else
85-
echo "Tarantool version is $T, as expected"
86-
fi
65+
- uses: ./.github/actions/verify-version
66+
with:
67+
tarantool-version: '${{ steps.latest-version.outputs.git-describe }}'
68+
from-cache: true
8769

8870
test-concurrency:
8971
strategy:

0 commit comments

Comments
 (0)