-
Notifications
You must be signed in to change notification settings - Fork 74
Fake build project and GitHub actions per scenario #739
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
Changes from all commits
58c72ef
5e5b4d0
2d6a6ec
5ff152c
1d3b137
610075f
0c501ed
9d6fed7
7f487c2
bf95a0b
53634ab
96cee24
1273264
2d0b69d
3e086ee
6ed6390
bb29921
f03ba05
a66df45
f51c133
351d768
79fac28
16ef629
450c033
7778841
15505f9
5e2c1a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # [Choice] Debian version (use bullseye on local arm64/Apple Silicon): bookworm, bullseye, buster | ||
| ARG VARIANT="bookworm" | ||
| FROM buildpack-deps:${VARIANT}-curl | ||
|
|
||
|
|
||
| ENV \ | ||
| # Enable detection of running in a container | ||
| DOTNET_RUNNING_IN_CONTAINER=true \ | ||
| DOTNET_ROOT=/usr/share/dotnet/ \ | ||
| DOTNET_NOLOGO=true \ | ||
| DOTNET_CLI_TELEMETRY_OPTOUT=false\ | ||
| DOTNET_USE_POLLING_FILE_WATCHER=true | ||
|
|
||
|
|
||
| # [Optional] Uncomment this section to install additional OS packages. | ||
| # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
| # && apt-get -y install --no-install-recommends <your-package-list-here> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| { | ||
| "name": "dotnet", | ||
| // Set the build context one level higher so we can grab metadata like global.json | ||
| "context": "..", | ||
| "dockerFile": "Dockerfile", | ||
| "forwardPorts": [ | ||
| 0 | ||
| ], | ||
| "features": { | ||
| // https://github.com/devcontainers/features/blob/main/src/common-utils/README.md | ||
| "ghcr.io/devcontainers/features/common-utils:2": { | ||
| "installZsh": true, | ||
| "installOhMyZshConfig": true, | ||
| "configureZshAsDefaultShell": true, | ||
| "username": "vscode", | ||
| "userUid": "1000", | ||
| "userGid": "1000", | ||
| "upgradePackages": true | ||
| }, | ||
| // https://github.com/devcontainers/features/blob/main/src/github-cli/README.md | ||
| "ghcr.io/devcontainers/features/github-cli:1": {}, | ||
| // https://github.com/devcontainers-contrib/features/blob/main/src/starship/README.md | ||
| "ghcr.io/devcontainers-contrib/features/starship:1": {}, | ||
| // https://github.com/devcontainers/features/blob/main/src/dotnet/README.md | ||
| "ghcr.io/devcontainers/features/dotnet:2": { | ||
| "version": "9.0.201" | ||
| } | ||
| }, | ||
| "overrideFeatureInstallOrder": [ | ||
| "ghcr.io/devcontainers/features/common-utils", | ||
| "ghcr.io/devcontainers/features/github-cli", | ||
| "ghcr.io/devcontainers-contrib/features/starship", | ||
| "ghcr.io/devcontainers/features/dotnet" | ||
| ], | ||
| "customizations": { | ||
| "vscode": { | ||
| // Add the IDs of extensions you want installed when the container is created. | ||
| "extensions": [ | ||
| "ms-dotnettools.csharp", | ||
| "Ionide.Ionide-fsharp", | ||
| "tintoy.msbuild-project-tools", | ||
| "ionide.ionide-paket", | ||
| "usernamehw.errorlens", | ||
| "alefragnani.Bookmarks", | ||
| "oderwat.indent-rainbow", | ||
| "vscode-icons-team.vscode-icons", | ||
| "EditorConfig.EditorConfig", | ||
| "GitHub.vscode-pull-request-github", | ||
| "github.vscode-github-actions" | ||
| ], | ||
| "settings": { | ||
| "terminal.integrated.defaultProfile.linux": "zsh", | ||
| "csharp.suppressDotnetInstallWarning": true | ||
| } | ||
| } | ||
| }, | ||
| "remoteUser": "vscode", | ||
| "containerUser": "vscode", | ||
| "containerEnv": { | ||
| // Expose the local environment variable to the container | ||
| // They are used for releasing and publishing from the container | ||
| "GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" | ||
| }, | ||
| "onCreateCommand": { | ||
| "enable-starship": "echo 'eval \"$(starship init zsh)\"' >> ~/.zshrc" | ||
| }, | ||
| "postAttachCommand": { | ||
| "restore": "dotnet tool restore && dotnet restore" | ||
| }, | ||
| "waitFor": "updateContentCommand" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,18 @@ | ||
| name: CI | ||
| name: Build, Test and SelfCheck | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| # to execute once a day (more info see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule ) | ||
| schedule: | ||
| - cron: '0 0 * * *' | ||
|
|
||
| push: | ||
| tags: | ||
| - 'v*' | ||
| branches: | ||
| - master | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xperiandri I know that you have put '**' for pull_request, but still putting this filter here will mean that a contributor that is about to post a PR won't get CI feedback until she proposes the PR, which is unnecessary. Contributors should be able to see the CI statuses before creating PRs. |
||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
|
||
| env: | ||
| DOTNET_VERSION: 9.0.201 | ||
|
|
||
| jobs: | ||
| buildAndTest: | ||
|
|
||
| build: | ||
| strategy: | ||
| matrix: | ||
| configuration: [Debug, Release] | ||
| os: | ||
| - ubuntu-latest | ||
| - windows-latest | ||
|
|
@@ -30,100 +21,48 @@ jobs: | |
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| - name: Setup necessary dotnet SDKs | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
| - name: Restore tools | ||
| run: dotnet tool restore | ||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
| - name: Build | ||
| run: dotnet fsi build.fsx -t Build | ||
| - name: Run tests | ||
| run: dotnet fsi build.fsx -t Test | ||
| - name: Run FSharpLint on itself | ||
| run: dotnet fsi build.fsx -t SelfCheck | ||
| global-json-file: global.json | ||
|
|
||
| - name: Build via Bash | ||
| if: runner.os != 'Windows' | ||
| run: ./build.sh | ||
| env: | ||
| CI: true | ||
| CONFIGURATION: ${{ matrix.configuration }} | ||
| - name: Build via Windows | ||
| if: runner.os == 'Windows' | ||
| run: ./build.cmd | ||
| env: | ||
| CI: true | ||
| CONFIGURATION: ${{ matrix.configuration }} | ||
|
|
||
| deployReleaseBinaries: | ||
| needs: buildAndTest | ||
| # Run SelfCheck once on Linux to check for lint warnings | ||
| selfcheck: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| - name: Setup necessary dotnet SDKs | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
| - name: Restore tools | ||
| run: dotnet tool restore | ||
| - name: Build | ||
| run: dotnet fsi build.fsx | ||
| - name: Pack | ||
| run: dotnet fsi build.fsx -t Pack | ||
| - name: Get Changelog Entry | ||
| id: changelog_reader | ||
| uses: mindsers/changelog-reader-action@v1 | ||
| with: | ||
| version: ${{ github.ref }} | ||
| path: ./CHANGELOG.md | ||
| - name: Upload binaries to nuget (if nugetKey present) | ||
| env: | ||
| nuget-key: ${{ secrets.NUGET_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: dotnet fsi build.fsx -t Push | ||
| - name: Create Release (if tag) | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| id: create_release | ||
| uses: actions/create-release@latest | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
| with: | ||
| tag_name: ${{ github.ref }} | ||
| release_name: ${{ github.ref }} | ||
| body: ${{ steps.changelog_reader.outputs.log_entry }} | ||
| draft: false | ||
| prerelease: false | ||
| - name: Upload binaries to release (if tag) | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: svenstaro/upload-release-action@v2 | ||
| with: | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
| file: out/*.nupkg | ||
| tag: ${{ github.ref }} | ||
| overwrite: true | ||
| file_glob: true | ||
| global-json-file: global.json | ||
|
|
||
| - name: Run SelfCheck | ||
| run: ./build.sh SelfCheck | ||
| env: | ||
| CI: true | ||
|
|
||
| deployReleaseDocs: | ||
| needs: deployReleaseBinaries | ||
| # Builds the project in a dev container | ||
| build-devcontainer: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
|
||
| # old .NET required by old fornax version | ||
| - name: Setup old .NET | ||
| uses: actions/setup-dotnet@v3 | ||
| with: | ||
| dotnet-version: 3.1.x | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Restore tools | ||
| run: dotnet tool restore | ||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
| - name: Run Fornax | ||
| run: dotnet fsi build.fsx -t Docs | ||
| - name: Deploy (if tag) | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: peaceiris/actions-gh-pages@v3 | ||
| - name: Build and run dev container task | ||
| uses: devcontainers/ci@v0.3 | ||
| with: | ||
| personal_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./docs/_public | ||
| publish_branch: gh-pages | ||
| force_orphan: true | ||
| runCmd: ./build.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: "Copilot Setup Steps" | ||
|
|
||
| # Automatically run the setup steps when they are changed to allow for easy validation, and | ||
| # allow manual testing through the repository's "Actions" tab | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
|
|
||
| jobs: | ||
| # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | ||
| copilot-setup-steps: | ||
| runs-on: windows-2025 | ||
|
|
||
| # Set the permissions to the lowest permissions possible needed for your steps. | ||
| # Copilot will be given its own token for its operations. | ||
| permissions: | ||
| # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. | ||
| contents: read | ||
|
|
||
| # You can define any steps you want, and they will run before the agent starts. | ||
| # If you do not check out your code, Copilot will do this for you. | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup necessary dotnet SDKs | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Deploy Docs | ||
|
|
||
| on: | ||
| # Runs on pushes targeting the default branch | ||
| push: | ||
| branches: ["master"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xperiandri we want PRs to the docs to also be tested before being merged, so please stop using the |
||
|
|
||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
|
|
||
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| # Build job | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
| - name: Setup necessary dotnet SDKs | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
|
|
||
| - name: Build Docs | ||
| run: ./build.sh builddocs | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: docs/_public | ||
|
|
||
| # Deployment job | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Publish to GitHub | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xperiandri even if we only want to publish for master branch, the way to filter it is to prevent the last step from happening (the nuget push) if branch is not master. This way the job is still being tested everytime, even for PRs. |
||
|
|
||
| env: | ||
| CONFIGURATION: Release | ||
|
|
||
| jobs: | ||
| build: | ||
| # Sets permissions of the GITHUB_TOKEN to allow release creating | ||
| permissions: | ||
| packages: write | ||
| environment: | ||
| name: nuget | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup necessary dotnet SDKs | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
|
|
||
| - name: Publish to GitHub | ||
| env: | ||
| NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| FAKE_DETAILED_ERRORS: true | ||
| run: ./build.sh "PublishToGitHub" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xperiandri why remove the schedule? this way we make sure that CI is still working, and when it breaks for reasons unrelated to FSharpLint commits we notice right away. Before I added this schedule job it used to happen that suddenly some new commit landed in master and broke CI and we were scratching our heads for days wondering how that commit could break the build, until we realised the CI broke by itself, unrelated to the commit.