Skip to content

Commit ea1c001

Browse files
authored
Merge pull request #33 from fermyon/versioned-releases
Make versioned releases
2 parents 18c1ad5 + 55f7d43 commit ea1c001

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
CARGO_TERM_COLOR: always
17-
RUST_VERSION: 1.78
17+
RUST_VERSION: "1.80"
1818
jobs:
1919
lint-rust:
2020
name: Lint Rust

.github/workflows/release.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "tests-v*"
79

810
env:
911
CARGO_TERM_COLOR: always
10-
RUST_VERSION: 1.78
12+
RUST_VERSION: "1.80"
1113

1214
jobs:
1315
build:
@@ -30,14 +32,27 @@ jobs:
3032
with:
3133
name: tests
3234
path: tests.tar.gz
35+
36+
- name: set the release version (tag)
37+
if: startsWith(github.ref, 'refs/tags/tests-v')
38+
shell: bash
39+
run: |
40+
echo "RELEASE_VERSION=$(echo ${{ github.ref_name }} | cut -c 7-)" >> $GITHUB_ENV
41+
echo "RELEASE_NOTE='The ${{ env.RELEASE_VERSION }} release of the conformance tests.'" >> $GITHUB_ENV
42+
43+
- name: set the release version (main)
44+
if: github.ref == 'refs/heads/main'
45+
shell: bash
46+
run: |
47+
echo "RELEASE_VERSION=canary" >> $GITHUB_ENV
48+
echo "RELEASE_NOTE='This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.'" >> $GITHUB_ENV
3349
3450
- name: Recreate canary release
3551
uses: ncipollo/[email protected]
3652
with:
37-
tag: canary
53+
tag: "${{ env.RELEASE_VERSION }}"
3854
allowUpdates: true
3955
prerelease: true
4056
artifacts: "tests.tar.gz"
4157
commit: ${{ github.sha }}
42-
body: |
43-
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**.
58+
body: "${{ env.RELEASE_NOTE }}"

crates/conformance-tests/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ use anyhow::Context as _;
44
use std::path::{Path, PathBuf};
55

66
/// Run the conformance tests
7+
///
8+
/// The version is either 'canary' or a release tag like 'v0.1.0'.
79
pub fn run_tests(
10+
version: &str,
811
run: impl Fn(Test) -> anyhow::Result<()> + Send + Clone + 'static,
912
) -> anyhow::Result<()> {
10-
let tests_dir = download_tests()?;
13+
let tests_dir = download_tests(version)?;
1114
run_tests_from(tests_dir, run)
1215
}
1316

@@ -28,10 +31,10 @@ pub fn run_tests_from(
2831
}
2932

3033
/// Download the conformance tests and return the path to the directory where they are written to
31-
pub fn download_tests() -> anyhow::Result<std::path::PathBuf> {
32-
let response = reqwest::blocking::get(
33-
"https://github.com/fermyon/conformance-tests/releases/download/canary/tests.tar.gz",
34-
)
34+
pub fn download_tests(version: &str) -> anyhow::Result<std::path::PathBuf> {
35+
let response = reqwest::blocking::get(format!(
36+
"https://github.com/fermyon/conformance-tests/releases/download/{version}/tests.tar.gz"
37+
))
3538
.context("failed to send request")?
3639
.error_for_status()?;
3740
let response = flate2::read::GzDecoder::new(response);

0 commit comments

Comments
 (0)