Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.4 #939

Closed
wants to merge 66 commits into from
Closed

0.8.4 #939

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
0fd752d
Trigger release on push, compare versions from toml and latest release
cptartur Oct 19, 2023
cac4585
Use correct output name
cptartur Oct 19, 2023
e8e0ec2
Set dependencies in setup node
cptartur Oct 19, 2023
fbbfca1
Run `npm ci`
cptartur Oct 19, 2023
3e41bc4
Add working directory
cptartur Oct 19, 2023
f801f4a
Remove unnecessary quotes
cptartur Oct 19, 2023
d7a3656
Echo values
cptartur Oct 19, 2023
acb5586
Use correct expression syntax
cptartur Oct 19, 2023
b635ec3
Add graceful shutdown
cptartur Oct 19, 2023
ad24ce5
Output true false
cptartur Oct 19, 2023
f16d99d
Use job output
cptartur Oct 19, 2023
3e4e214
Use expression syntax
cptartur Oct 19, 2023
486a011
Use `needs`
cptartur Oct 19, 2023
d7cd0ed
Use single quotes
cptartur Oct 19, 2023
2c2ee35
Bump version
cptartur Oct 19, 2023
e41e6bd
Echo steps output
cptartur Oct 19, 2023
4e9ee7a
Echo steps output
cptartur Oct 19, 2023
2112d9a
Fix arguments order
cptartur Oct 19, 2023
6c04152
Remove echos
cptartur Oct 19, 2023
5549170
Use correct argument names
cptartur Oct 19, 2023
183c385
Echo version
cptartur Oct 19, 2023
1626a83
Echo version
cptartur Oct 19, 2023
ef0ae9a
Revert "Echo version"
cptartur Oct 19, 2023
ab56afc
Define outputs correctly
cptartur Oct 19, 2023
4cfdc40
Use quotation marks
cptartur Oct 19, 2023
fafb910
Add missing `$`
cptartur Oct 19, 2023
0667609
Decrease version to 0.8.3
cptartur Oct 19, 2023
8dafe09
Add echos
cptartur Oct 19, 2023
fff761e
Remove commented out code
cptartur Oct 19, 2023
40548cb
Remove `)`
cptartur Oct 19, 2023
aa8718b
Fix syntax
cptartur Oct 19, 2023
16a1d27
Fix syntax
cptartur Oct 19, 2023
4ab3af9
Add create tag action
cptartur Oct 19, 2023
2d6f4a2
Rename tag action
cptartur Oct 19, 2023
51eda02
Bump version
cptartur Oct 19, 2023
54c2209
Trigger release on tag push
cptartur Oct 19, 2023
e79bd5f
Remove unnecessary job output
cptartur Oct 19, 2023
77df6ba
Restore 0.8.3
cptartur Oct 19, 2023
60cc8f9
Bump to 0.8.4
cptartur Oct 19, 2023
b71417a
Trigger release on tag creation
cptartur Oct 19, 2023
b3f88cc
Push
cptartur Oct 19, 2023
7a59f9e
Create tag as part of release workflow
cptartur Oct 20, 2023
949272d
Add names to jobs
cptartur Oct 20, 2023
5966ced
Require changelog in release workflow
cptartur Oct 23, 2023
eaab1e8
Add action to generate changelogs in PRs
cptartur Oct 23, 2023
3bec079
Temporarily disable building artifacts
cptartur Oct 23, 2023
8c7db1e
Specify tag in the release creation workflow
cptartur Oct 23, 2023
e3d4300
Fix tag creation trigger
cptartur Oct 23, 2023
872b826
Add missing `$`
cptartur Oct 23, 2023
6fcc211
Use double quotes in sed command
cptartur Oct 23, 2023
5abb9a9
Fix expression
cptartur Oct 23, 2023
5a1c15b
Specficy what file to use in sed command
cptartur Oct 23, 2023
3a0a857
Add write permission to changelog action
cptartur Oct 23, 2023
3c4092f
Add square brackets to heading
cptartur Oct 23, 2023
95345c8
Use better commit message for changelog update
cptartur Oct 23, 2023
1b79986
Strip `v` from version in changelog
cptartur Oct 23, 2023
85ef499
Use Krakow timezone
cptartur Oct 23, 2023
8bcdecb
Update replacing logic
cptartur Oct 23, 2023
f6be510
Replace `if` with `fi`
cptartur Oct 23, 2023
c04abcd
Only commit changelog if it was updated
cptartur Oct 23, 2023
ba844ac
Restore commented out code
cptartur Oct 23, 2023
26b59bb
Remove commented out code
cptartur Oct 23, 2023
35b4d78
Trigger release
cptartur Oct 23, 2023
8da39a8
Restore 0.8.3
cptartur Oct 23, 2023
ff10bd1
Use foundry-rs repo in lookupVersionRelesae
cptartur Oct 23, 2023
2346a15
Bump version 0.8.4
cptartur Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/generate_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Generate changelog in PR

on:
pull_request:

permissions:
contents: write

jobs:
verify-version:
name: Verify that version that triggered this workflow is greater than most recent release
runs-on: ubuntu-latest
outputs:
versionIsValid: ${{ steps.validVersion.outputs.versionIsValid }}
version: ${{ steps.validVersion.outputs.version }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
cache: 'npm'
cache-dependency-path: scripts/package-lock.json
- run: npm ci
working-directory: scripts

- name: Get version from Cargo.toml
id: lookupVersion
uses: mikefarah/yq@a198f72367ce9da70b564a2cc25399de8e27bf37
with:
cmd: yq -oy '"v" + .workspace.package.version' 'Cargo.toml'

- name: Get version from the latest releases
id: lookupVersionRelease
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: cptartur
repo: starknet-foundry
excludes: prerelease, draft

- name: Compare versions
id: validVersion
run: |
RELEASE_VERSION=${{ steps.lookupVersionRelease.outputs.release }}
COMMIT_VERSION=${{ steps.lookupVersion.outputs.result }}
echo "Project version from newest release = $RELEASE_VERSION"
echo "Project version from this commit = $COMMIT_VERSION"
IS_VALID=$(node ./scripts/compareVersions.js $RELEASE_VERSION $COMMIT_VERSION)
echo "versionIsValid=$IS_VALID" >> "$GITHUB_OUTPUT"
echo "version=$COMMIT_VERSION" >> "$GITHUB_OUTPUT"

- name: Output job skipped
if: ${{ steps.validVersion.outputs.versionIsValid == 'false' }}
run: echo "Version from commit is not greater from newest release, skipping build"

generate-changelog:
name: Convert unreleased section in CHANGELOG.md to new release
runs-on: ubuntu-latest
needs: verify-version
if: ${{ needs.verify-version.outputs.versionIsValid == 'true' }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- run: |
RELEASE_VERSION=${{ needs.verify-version.outputs.version }}
RELEASE_VERSION="${RELEASE_VERSION:1}"

if ! grep -q $RELEASE_VERSION CHANGELOG.md; then
sed -i "s/## \[Unreleased\]/## \[Unreleased\]\n\n## \[${RELEASE_VERSION}\] - $(TZ=Europe/Krakow date '+%Y-%m-%d')/" CHANGELOG.md
fi

- name: Commit CHANGELOG.md
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add CHANGELOG.md
git diff --cached --quiet || git commit -m "Update CHANGELOG.md"

- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}
69 changes: 62 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Release

on:
push:
branches:
- 'master'
create:
tags:
- v[0-9]+.*

Expand All @@ -10,23 +13,73 @@ permissions:

jobs:
verify-version:
name: Verify that version that triggered this workflow is greater than most recent release
runs-on: ubuntu-latest
outputs:
versionIsValid: ${{ steps.validVersion.outputs.versionIsValid }}
version: ${{ steps.validVersion.outputs.version }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
cache: 'npm'
cache-dependency-path: scripts/package-lock.json
- run: npm ci
working-directory: scripts

- name: Get version from Cargo.toml
id: lookupVersion
uses: mikefarah/yq@a198f72367ce9da70b564a2cc25399de8e27bf37
with:
cmd: yq -oy '"v" + .workspace.package.version' 'Cargo.toml'

- name: Version check
if: steps.lookupVersion.outputs.result != github.ref_name
run: echo "Project version in Cargo.toml does not match the tag" && exit 1
- name: Get version from the latest releases
id: lookupVersionRelease
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: foundry-rs
repo: starknet-foundry
excludes: prerelease, draft

- name: Compare versions
id: validVersion
run: |
RELEASE_VERSION=${{ steps.lookupVersionRelease.outputs.release }}
COMMIT_VERSION=${{ steps.lookupVersion.outputs.result }}
echo "Project version from newest release = $RELEASE_VERSION"
echo "Project version from this commit = $COMMIT_VERSION"
IS_VALID=$(node ./scripts/compareVersions.js $RELEASE_VERSION $COMMIT_VERSION)
echo "versionIsValid=$IS_VALID" >> "$GITHUB_OUTPUT"
echo "version=$COMMIT_VERSION" >> "$GITHUB_OUTPUT"

- name: Output job skipped
if: ${{ steps.validVersion.outputs.versionIsValid == 'false' }}
run: echo "Version from commit is not greater from newest release, skipping build"

create-tag:
name: If workflow was triggered by a push to master, create a new tag with release version
runs-on: ubuntu-latest
needs: verify-version
if: ${{ needs.verify-version.outputs.versionIsValid == 'true' }}

steps:
- name: Create tag action was triggered by a push
if: ${{ github.event_name == 'push' }}
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.verify-version.outputs.version }}',
sha: context.sha
})

build-binaries:
name: Build ${{ matrix.target }}
needs: verify-version
needs: create-tag
# if: ${{ needs.verify-version.outputs.versionIsValid == 'true' }}
runs-on: ${{ matrix.os }}
continue-on-error: true

Expand Down Expand Up @@ -94,7 +147,7 @@ jobs:
shell: bash
run: |
set -euxo pipefail
PKG_FULL_NAME="starknet-foundry-${{ github.ref_name }}-${{ matrix.target }}"
PKG_FULL_NAME="starknet-foundry-${{ github.ref_name }}-${{ matrix.target }}"
echo "PKG_FULL_NAME=$PKG_FULL_NAME" >> $GITHUB_ENV

chmod +x ./scripts/package.sh
Expand All @@ -109,7 +162,7 @@ jobs:
create-release:
name: Draft release
runs-on: ubuntu-latest
needs: build-binaries
needs: [build-binaries, verify-version]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -130,8 +183,10 @@ jobs:
uses: taiki-e/create-gh-release-action@9762dfdfe60a96b3fef6c4a0aaafd9840f1195b7
with:
token: ${{ secrets.GITHUB_TOKEN }}
changelog: CHANGELOG.md
allow-missing-changelog: false
title: $version
draft: true
ref: refs/tags/${{ needs.verify-version.outputs.version }}

- name: Upload artifacts to the release
working-directory: artifacts
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pyproject.toml
target
.vscode/
.env
*/node_modules
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
]

[workspace.package]
version = "0.8.3"
version = "0.8.4"
edition = "2021"
repository = "https://github.com/foundry-rs/starknet-foundry"
license = "MIT"
Expand Down
11 changes: 11 additions & 0 deletions scripts/compareVersions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const semver = require('semver')

if (process.argv.length !== 4) {
console.error('Two arguments requred');
process.exit(1);
}

const old_version = process.argv[2];
const new_version = process.argv[3];

console.log((semver.gt(new_version, old_version)).toString())
65 changes: 65 additions & 0 deletions scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"semver": "^7.5.4"
}
}
Loading